Hi,

I seemingly have a simple problem, but I've spend hours reading guides &
posts on this forum and I can't seem to piece together what I need.
I have a dataframe where I want to divide it into two subsets: a sample, and
the remainder of the dataframe in a new frame.
I've tried this:

split(df, sample(nrow(df), size=100, replace=FALSE))

another way would be to make a new dataframe of my sample and (something I
can do in SQL but not R) then select rows that are NOT in the sample
dataframe.

Thanks for any help!

        [[alternative HTML version deleted]]

______________________________________________
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