If your datasets are dataframes (or you could convet matrices to dataframes), you can use
merge(x, y, by = "site") if y sites are a subset of x that will work, but if there are some sites in y that are not in x, then I think you would write merge(x, y, by = "site", all = TRUE) which will keep sites in y that are not in x, then you could just delete sites not in x but in y On Thursday, March 17, 2011 at 8:17 AM, Andres Mellado Diaz wrote: > > > Dear list members, > > I have two data sets (sites by species) with some sites in common, one with > invertebrate data (X) and one with diatoms data (Y). I would like to get both > new Xc and Yc matrices showing only those sites common to X and Y, to make > similarity matrices and perform a mantel test. Hope you can help me with this, > > Many thanks in advance, > > Andrés > > Dr. Andrés Mellado DÃaz > > Center for Hydrological Studies CEH-CEDEX > Water Quality Department > Pº bajo de la Virgen del Puerto, 3 > 28005, Madrid > SPAIN > [[alternative HTML version deleted]] > _______________________________________________ > R-sig-ecology mailing list > R-sig-ecology@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-ecology > [[alternative HTML version deleted]]
_______________________________________________ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology