SCM

SCM Repository

[batman] View of /pkg/batman/R/createPureSpectraTemplate.R
ViewVC logotype

View of /pkg/batman/R/createPureSpectraTemplate.R

Parent Directory Parent Directory | Revision Log Revision Log


Revision 120 - (download) (annotate)
Tue Feb 12 16:30:46 2013 UTC (6 years, 7 months ago) by jie
File size: 758 byte(s)
pkg
createPureSpectraTemplate <- function(dirPureSpec, metaNames, dirIP)
{
## written by Dr. Jie Hao
  if (length(dirPureSpec) != length(metaNames))
  {
    stop("Length of PureSpectra and metaNames does not match.\n")
  }
  
  dirPST<-paste(dirIP,"/PureSpectraTemplate",sep="")
  if(!file.exists(dirPST)){
    dir.create(dirPST)
  }
  
  for (n in 1:length(dirPureSpec))
  {
    ps <- readBruker(dirPureSpec[n])
    if (dim(ps)[2] !=2)
    {
      stop(paste("More than one spectrum found from row ", n, " of PureSpectra:\n", dirPureSpec[n], "\n", sep =""))
    }
    if (ps[1,1] > ps[2,1])
    {
      ps <- ps[nrow(ps):1,]
    }
    write.table(ps,file=paste(dirPST,"/",metaNames[n],".txt",sep=""),row.names=FALSE,col.names=FALSE,quote=FALSE,sep = "\t")
  }
}

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge