PageRenderTime 27ms CodeModel.GetById 18ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

/working/auteur.extended/R/cleanup.files.R

http://github.com/eastman/auteur
R | 24 lines | 18 code | 4 blank | 2 comment | 3 complexity | 5c9ff91d7e133923fe9c737f22dc11af MD5 | raw file
 1#utility for converting text files to .rda to compress output from rjmcmc
 2#author: JM EASTMAN 2011
 3
 4cleanup.files <-
 5function(parmBase, model, fileBase){
 6	if(model=="BM") {
 7		parms=c("rates","rate.shifts")
 8	} else if(model=="OU") {
 9		parms=c("optima","optima.shifts")
10	}
11	
12	posteriorsamples=lapply(parms, function(x) {
13							y=read.table(paste(parmBase,paste(x,"txt",sep="."),sep="/"))
14							names(y)=y[1,]
15							y=y[-1,]
16							row.names(y)=1:nrow(y)
17							return(y)
18							})
19	
20	names(posteriorsamples)=parms
21	save(posteriorsamples, file=paste(parmBase,paste(fileBase,"posteriorsamples","rda",sep="."),sep="/"))
22	unlink(paste(parmBase,paste(parms,"txt",sep="."),sep="/"))
23}
24