This function should return a proper list with all the data.frames as elements
dfs <- Filter(function(x) is(x, "data.frame"), mget(ls()))
then you can rbind them with
do.call(rbind, dfs)
Of course it’s awfully silly to have a bunch of data.frames lying around that are so related that you want to rbind
them. It sounds like they probably should have been in a list in the first place.
I recommend you say away from assign()
, that’s always a sign things are probably afoul. Try
temp <- list.files(pattern="*.csv")
dfs <- lapply(temp, read.csv)
that should return a list straight away.