I have a nested list that looks like this:
dput(head(tempList))
structure(list(Species = c("RandArcBo1", "RandArcBo1", "RandArcBo1",
"RandArcBo1", "RandArcBo1", "RandArcBo1", "RandArcBo1", "RandArcBo1",
"RandArcBo1", "RandArcBo1", "RandArcBo1", "RandArcBo1", "RandArcBo1",
"RandArcBo1", "RandArcBo1", "RandArcBo1"), x = c(132.5, 156.5,
178.5, 159.5, 166.5, 133.5, 103.5, 162.5, 165.5, 143.5, -163.5,
178.5, 151.5, 163.5, -120.5, -151.5), y = c(84.567321777, 83.567321777,
60.567321777, 77.567321777, 56.567321777, 74.567321777, 85.567321777,
70.567321777, 55.567321777, 74.567321777, 66.567321777, 72.567321777,
81.567321777, 53.567321777, 85.567321777, 76.567321777), Species = c("RandArcBo2",
"RandArcBo2", "RandArcBo2", "RandArcBo2", "RandArcBo2", "RandArcBo2",
"RandArcBo2", "RandArcBo2", "RandArcBo2", "RandArcBo2", "RandArcBo2",
"RandArcBo2", "RandArcBo2", "RandArcBo2", "RandArcBo2", "RandArcBo2"
), x = c(150.5, 121.5, 169.5, 174.5, 175.5, 153.5, -97.5, 169.5,
159.5, 166.5, -114.5, -92.5, -176.5, -167.5, 136.5, -133.5),
y = c(55.567321777, 76.567321777, 58.567321777, 80.567321777,
83.567321777, 82.567321777, 83.567321777, 57.567321777, 75.567321777,
55.567321777, 74.567321777, 77.567321777, 68.567321777, 67.567321777,
74.567321777, 70.567321777)), .Names = c("Species", "x",
"y", "Species", "x", "y"))
What I want is to join these data into single table with three columns, "Species", "x" and "y" (each row is labeled with a species name that may repeat, followed by an x,y coordinate). Cbind puts the second order lists in columns next to each other so I end up with a number of columns equal to 3* the number of first-order objects. Rbind puts the second order lists into rows so that I end up with a number of columns equal to the length of the second order lists. Any suggestions?
Here's a general approach:
data.frame(sapply(unique(names(tempList)),
function(name) do.call(c, tempList[names(tempList) == name]), simplify=FALSE)
)