Skip to content
Prev 246604 / 398506 Next

Multiple subsets of data

You're definitely doing something I don't understand.
Here's a quick mock-up of the sample data sets you provided.  How do you know if species a in trait is from NA1102 or  AT1302  in com?  I may be blind but I just don't see what you're matching when you use which.  Perhaps you might want to post the which command you're using?

By the way dput is a valuable way of providing sample data. 

trait <- structure(list(Species = c("a", "b", "c"), v1 = c("t", "f", "r"
), v2 = c("y", "j", "y"), v3 = c("h", "u", "u")), .Names = c("Species",
"v1", "v2", "v3"), class = "data.frame", row.names = c(NA, -3L
))

com <- structure(list(community = c("NA1102", "NA1102", "NA0402", "NA0402",
"AT1302", "AT1302"), species = c("a", "c", "b", "c", "a", "b"
)), .Names = c("community", "species"), class = "data.frame", row.names = c(NA,
-6L))