Skip to content
Prev 19887 / 398500 Next

Combining many dataframes from listings of objects?

Derek Eder asks:
"automatically" specifying the names of the dataframes as listing of object
names.
conceptually like this :
"BA.Nt1.nREM.APNEA.OBSTRUCTIVE.bp.df"
"BA.Nt2.nREM.APNEA.OBSTRUCTIVE.bp.df"
"BA.Nt2.REM.APNEA.OBSTRUCTIVE.bp.df"
[WNV]  This is a natural do.call problem, but you need to be a bit
careful.  The second argument has to be a list either of the arguments
themselves or names that evaluate to the arguments.  The obvious choice here
is names.  The following is a mock example with hints of yours.

	> a.df <- b.df <- c.df <- data.frame(x = 1:3, y = letters[1:3])
	> a.df
	  x y
	1 1 a
	2 2 b
	3 3 c
	> do.call("rbind", lapply(objects(pat="*.df$"), as.name))
	  x y
	1 1 a
	2 2 b
	3 3 c
	4 1 a
	5 2 b
	6 3 c
	7 1 a
	8 2 b
	9 3 c
	>
dataframe and then
is failing in R:
= vjj)
= vjj)
= vjj)
= vjj)
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-
http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._