1

I would like to select and import ca. 30 dataframes from my global environment into a list. All my dataframes end with ".AM", therefore should be very easy to import them but I am still quite new to R.

I tried:

mylist <- list(pattern = "*.AM")

but it doesn't work.

  • This is a [duplicate](http://stackoverflow.com/questions/17499013/how-do-i-make-a-list-of-data-frames). See the answers here as well. – lmo Jul 08 '16 at 11:52

3 Answers3

4

We can use mget to return the datasets in a list.

mget(ls(pattern =  "*.AM"))
akrun
  • 789,025
  • 32
  • 460
  • 575
1

you are looking for

mylist <- ls(pattern = ".AM")

which returns mylist as a vector of the matching object names

loki
  • 8,836
  • 6
  • 49
  • 76
0

try to set the working directory to wherever the files are saved

setwd("C:\\user\\files")

then create a list of the .AM dataframes

mylist = list.files(pattern="*.AM") 

I guess that should work?

DuEllier
  • 15
  • 4