maximusyoda maximusyoda - 3 months ago 11
R Question

How can I make a list of all dataframes that are in my global environment?

I am trying to use

rbind
on them. But I need a list of all the
dataframes
that are already in my global environment. How can I do it?

Code I used to import the 20 csv files in a directory. Basically, have to combine into a single dataframe.

temp = list.files(pattern = "*.csv")
for (i in 1:length(temp)) assign(temp[i], read.csv(temp[i]))

Answer

From your posted code, I would recommend you start a new R session, and read the files in again with the following code

do.call(rbind, lapply(list.files(pattern = ".csv"), read.csv))
Comments