[R] "merging" rows that share columns (but not all of them)
arun
smartpink111 at yahoo.com
Wed Oct 30 04:22:08 CET 2013
Hi,
May be this helps.
library(plyr)
res <- join_all(lapply(my.list,function(x) as.data.frame(t(unlist(x)))),type="full")
res
# AICc Intercept Burned StandAge TreeDensity RoadDensity Intercept.SE
#1 108.2303 -1.3358063 1.351866 0.05606852 -0.1886327 -0.03904008 0.8392739
#2 207.4494 0.1749414 NA NA NA NA 0.1644731
# Burned.SE StandAge.SE TreeDensity.SE RoadDensity.SE
#1 0.5440936 0.009632702 0.03885338 0.02995221
#2 NA NA NA NA
A.K.
Hi,
I have a list where the columns are generally subsets of a full
set of columns. Below is an example where the 1st vector in the list
has the full set of columns and the 2nd has a very reduced set of those
columns. What is a good way to "merge" these lists together so that the
resulting data.frame has all of the columns and either blanks or NA's
(whatever) in the empty elements for the reduced set?
Hopefully that makes sense, and I thank you ahead of time for any suggestions.
Chuck
my.list <- dput( list(out.j[[4]], out.j[[5]]) )
list(list(structure(c(108.230267668738, -1.33580630289532, 1.35186573380126,
0.0560685186378393, -0.188632664093942, -0.0390400817030916,
0.839273914449761, 0.544093628209087, 0.00963270189999436, 0.038853380878141,
0.0299522140838543), .Names = c("AICc", "Intercept", "Burned",
"StandAge", "TreeDensity", "RoadDensity", "Intercept.SE", "Burned.SE",
"StandAge.SE", "TreeDensity.SE", "RoadDensity.SE"))), structure(c(207.449399095215,
0.174941449287965, 0.164473092811635), .Names = c("AICc", "Intercept",
"Intercept.SE")))
More information about the R-help
mailing list