# MakeData.R # use: on the linux command line: # $ Rscript MakeData.R # read data into a data frame files<-list.files("../../../pbe400/s32/raman/",recursive=TRUE, pattern="a_iso_spectrum.dat",full=TRUE) data<-lapply(files,read.table) ds<-do.call("cbind",data) runs<-length(ds[1,])/2 size<-length(ds[,1]) temp<-c(1:runs) dsOUT<-cbind(seq(1,size,1),seq(1,size,1),seq(1,size,1)) for(i in seq(1,size,1)){ temp<-as.vector(unlist(ds[i,c(seq(2,2*runs,2))])) dsOUT[i,1]<-ds[i,1] dsOUT[i,2]<-signif(mean(temp), digits = 8) dsOUT[i,3]<-signif(sd(temp), digits = 8) } write("# a_iso_spectrum_AVG STDDEV","PBE400.dat") write.table(dsOUT, file = "PBE400.dat", append = TRUE, row.names = FALSE, col.names = FALSE)