[R] Random sample from a data frame where ID column values don't match the values in an ID column in a second data frame
dwinsemius at comcast.net
Thu Mar 29 22:00:48 CEST 2012
On Mar 29, 2012, at 2:37 PM, inkhorn wrote:
> 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)
> the values in its ID column *are not* in the equivalent ID column in
> 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
> samples are drawn from main.df.
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 at r-project.org mailing list
> 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
More information about the R-help