On Jul 15, 2010, at 2:37 PM, Addi Wei wrote:

> 
> e.g. I have a big data set called "combined", and then a small sample of
> "combined" called "miceSample".  I wish to delete "miceSample" from
> "combined" to create a new smaller data set and store it into a new object. 
> 
> combined <- rbind(scaleMiceTrain, scaleMiceTest)
> miceSample <- sample(combined[,-c(1,2)],nvars, replace=FALSE)
> 
> How do I do that?  

See ?subset

If you have a column in your data frame, say called 'Group', that contains an 
indicator as to which group each record belongs to:

  subset(combined, Group != "miceSample")

will return a new data frame without the records where the Group column 
contains 'miceSample'.

HTH,

Marc Schwartz

______________________________________________
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.

Reply via email to