In save() you can use the "list" argument to give object names. So save(list = sample[i], file=paste0(sample.name[i],".rda")) should work.
Best, Kasper On Thu, Jul 14, 2016 at 9:21 AM, Obenchain, Valerie < valerie.obench...@roswellpark.org> wrote: > Hi, > > There may be more elegant ways but here is one solution. > > sample.name <- c("ABC_study_provider", "XYZ_study_provider") > lapply(sample.name, > function(xx) { > filename <- paste0(xx, ".rda") > ## make the GAlignmentPairs > ## ... > xx <- GAlignmentPairs() > save(xx, file=filename) > }) > > Val > > > On 07/14/2016 05:40 AM, Michael Love wrote: > > dear Valerie, > > > > This is a simple R question, but I can't seem to find the answer. I'm > > assuming ExperimentHub wants object created by save() and not > > saveRDS(). > > > > In make-data.R, I have a loop where I programmatically make a > > GAlignmentPairs object for each of 4 samples. I'm then using assign() > > to assign the value to an appropriate name, e.g. > > > > assign(sample.name[i], x) > > > > where x is a GAlignmentPairs object I've made. > > > > I'm having trouble though saving this to a file. My first try was: > > > > save(sample.name[i], file=paste0(sample.name[i],".rda")) > > > > But this gives: > > > > Error in save(sample.name[i], file = ... > > object 'sample.name[i]' not found > > > > I also tried get(), but it's also giving the "not found" error. > > > > save(get(sample.name[i]), file=paste0(sample.name[i],".rda")) > > > > > > thanks > > Mike > > > > On Thu, Jun 30, 2016 at 6:41 PM, Obenchain, Valerie > > <valerie.obench...@roswellpark.org> wrote: > >> Hi Mike, > >> > >> Yes, let's go the ExperimentHub route. The focus is on detailed > >> documentation / real use cases so the vignette you describe sounds like > >> a good fit. > >> > >> Essentially you'll put a package together that is very similar to an > >> experimental data package with a few extra files described in the > >> ExperimentHubData vignette: > >> > >> > >> > http://www.bioconductor.org/packages/3.4/bioc/vignettes/ExperimentHubData/inst/doc/ExperimentHubData.html > >> > >> Let me know when you've got the data objects ready and I'll put them in > >> S3. Once that's done we'll test the package functions and put the > >> package through a review on the new tracker. > >> > >> Val > >> > >> > >> > >> On 06/30/2016 09:27 AM, Michael Love wrote: > >>> I want to generate an experimental data package with a small subset of > >>> alignments. The end goal is a software vignette, where the user would > >>> specify BAM files. I'd like to try out the ExperimentHub submission > >>> process, which is for R data objects. Does it sound reasonable if I > >>> were to have an initial code chunk that loads GAlignments and writes > >>> out BAM files using rtracklayer::export to then show the use of > >>> software with BAM files? There would be so few alignments that it > >>> wouldn't be a large computational or storage expense. Or should I > >>> submit a standard Bioc experimental data package with files in > >>> inst/extdata? > >>> > >>> _______________________________________________ > >>> Bioc-devel@r-project.org mailing list > >>> https://stat.ethz.ch/mailman/listinfo/bioc-devel > >>> > >> > >> > >> This email message may contain legally privileged and/or confidential > information. If you are not the intended recipient(s), or the employee or > agent responsible for the delivery of this message to the intended > recipient(s), you are hereby notified that any disclosure, copying, > distribution, or use of this email message is prohibited. If you have > received this message in error, please notify the sender immediately by > e-mail and delete this email message from your computer. Thank you. > > > > This email message may contain legally privileged and/or confidential > information. If you are not the intended recipient(s), or the employee or > agent responsible for the delivery of this message to the intended > recipient(s), you are hereby notified that any disclosure, copying, > distribution, or use of this email message is prohibited. If you have > received this message in error, please notify the sender immediately by > e-mail and delete this email message from your computer. Thank you. > _______________________________________________ > Bioc-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/bioc-devel > [[alternative HTML version deleted]] _______________________________________________ Bioc-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel