You can use ls()
with get
as follows:
l.df <- lapply(ls(), function(x) if (class(get(x)) == "data.frame") get(x))
This'll load all data.frames from your current environment workspace.
Alternatively, as @agstudy suggests, you can use pattern to load just the data.frame
s you require.
l.df <- lapply(ls(pattern="df[0-9]+"), function(x) get(x))
Loads all data.frame
s in current environment that begins with df
followed by 1 to any amount of numbers.