0

I have a number of datasets, all named df_some number. I'd like to run the same commands on all of these and save the results. Most of what I've seen suggests I should place all the datasets in a list.

How do I do this (ie, capture all of the similarly named datasets and place them in a list) without having to type the name of every dataset?

vashts85
  • 897
  • 2
  • 12
  • 26
  • 1
    Probably `mget` is what you want. – joran Oct 31 '16 at 18:24
  • can someone find the dupe for this? – Ben Bolker Oct 31 '16 at 18:25
  • @BenBolker Here's one possibility: http://stackoverflow.com/q/18897473/324364 – joran Oct 31 '16 at 18:27
  • Are these data sets being created by code in R, or are you reading a bunch of separate data files into separate data frames? Either way, if you put them in a list to begin with, you won't have a combine them into a list after the fact. For example, if you're loading the data from csv files, you could do `df.list = lapply(list.files(pattern="csv"), read.csv)`. – eipi10 Oct 31 '16 at 18:28
  • It's one large file with an identifier column I'd like to split them by. I ended up doing something like: `my.list2 – vashts85 Oct 31 '16 at 21:19

0 Answers0