[R] Reconciling 2 datasets

chipmaney chipmaney at hotmail.com
Sat Jul 24 00:38:53 CEST 2010


I have a dataframe:

Empirical.df <- data.frame(ID=c("MCUP1-2","MCUP2-5", "MCUP3-3",
"MCUP4-3","MCUP5-9"), Cover=c(60,40,45,68,72))


However, I only want to use a subset of Cover.df for my analysis. The
samples I want to use are:

Samples.v <- c("MCUP1-2", "MCUP4-3","MCUP5-9")

How do I use indexing Empirical.df by Samples.v to return a new dataframe
with only the data I am interested in?

Here is what I mean:

Cover.df <- Empirical.df[???,]

returns:

Cover.df
>> Cover.df
       ID        Cover
1 MCUP1-2    60
3 MCUP4-3    68
5 MCUP5-9    72
-- 
View this message in context: http://r.789695.n4.nabble.com/Reconciling-2-datasets-tp2300772p2300772.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list