Christopher Desjardins
2013-Feb-04 17:02 UTC
[R] Combining data from different saved files with same object names into one data frame
Hi, I am simulating data from a zero-inflated negative binomial model. I have 4 different conditions and I've saved various information about the models in zinbsumbstat-jklm.rdata (as shown below). What I want to do is print information from each of these *.rdata and store them in one large object (a matrix or a data frame). However, within each data the objects all have the same name. So I don't know how to combine these into one object. Below is the code that I could use to paste all the information into the console. for(j in 1:2){ for(k in 1:6){ for(l in 1:2){ for(m in 1:2){ fsumstatZINB=paste("/Users/chris/Dropbox/phd/analysis/Simulation/zinbmodels/summaries/zinbsumstat-",j,k,l,m,".rdata", sep="") load(fsumstatZINB) print(zinbMeans[,1]) } } } } How could I combine all the information from these loops into a matrix() or a data.frame()? Two of the datasets [1,2] are pasted in a public Dropbox. Thanks! Chris [1] https://dl.dropbox.com/u/1501309/zinbsumstat-1111.rdata [2] https://dl.dropbox.com/u/1501309/zinbsumstat-1112.rdata [[alternative HTML version deleted]]
jim holtman
2013-Feb-04 17:17 UTC
[R] Combining data from different saved files with same object names into one data frame
Try this storing them to a list with the j,k,l,m as an index: result <- list() for(j in 1:2){ for(k in 1:6){ for(l in 1:2){ for(m in 1:2){ fsumstatZINB=paste("/Users/chris/Dropbox/phd/analysis/Simulation/zinbmodels/summaries/zinbsumstat-",j,k,l,m,".rdata", sep="") load(fsumstatZINB) print(zinbMeans[,1]) result[[paste(j,k,l,m)]] <- zinbMeans } } } } On Mon, Feb 4, 2013 at 12:02 PM, Christopher Desjardins <cddesjardins at gmail.com> wrote:> Hi, > > I am simulating data from a zero-inflated negative binomial model. I have 4 > different conditions and I've saved various information about the models in > zinbsumbstat-jklm.rdata (as shown below). What I want to do is print > information from each of these *.rdata and store them in one large object > (a matrix or a data frame). However, within each data the objects all have > the same name. So I don't know how to combine these into one object. Below > is the code that I could use to paste all the information into the console. > > for(j in 1:2){ > for(k in 1:6){ > for(l in 1:2){ > for(m in 1:2){ > > fsumstatZINB=paste("/Users/chris/Dropbox/phd/analysis/Simulation/zinbmodels/summaries/zinbsumstat-",j,k,l,m,".rdata", > sep="") > load(fsumstatZINB) > print(zinbMeans[,1]) > } > } > } > } > > How could I combine all the information from these loops into a matrix() or > a data.frame()? > > Two of the datasets [1,2] are pasted in a public Dropbox. > Thanks! > Chris > > [1] https://dl.dropbox.com/u/1501309/zinbsumstat-1111.rdata > [2] https://dl.dropbox.com/u/1501309/zinbsumstat-1112.rdata > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it.
Maybe Matching Threads
- Simplest way of executing a non-blocking (async) python AGI script?
- Simplest way of executing a non-blocking (async) python AGI script?
- Suppressing the labelling of tick marks on ggplot2
- Confidence bands in ggplot2
- SPSS F-test on change in R square between hierarchical models