On Mar 29, 2012, at 2:37 PM, inkhorn wrote:
Hello,
Let's say I've drawn a random sample () from a large data frame
(main.df), and I want to create a second random sample (sample2.df)
where
the values in its ID column *are not* in the equivalent ID column in
the
first sample (sample1.df). How would I go about doing this?
In other words:
The values in sample2.df$ID *are not found* in sample1.df$ID, and
both
samples are drawn from main.df.
?"%in%"
sample2.df <- main.df[ ! main.df[, "ID"] %in% sample1.df[, "ID"] , ]
Thanks in advance,
Matt Dubins
--
View this message in context:
http://r.789695.n4.nabble.com/Random-sample-from-a-data-frame-where-ID-column-values-don-t-match-the-values-in-an-ID-column-in-a-se-tp4516448p4516448.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
David Winsemius, MD
West Hartford, CT
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.