Hi,
I am looking for a way to randomly extract a specified number of rows from a
data frame. I was planning on binding a column of random numbers to the
data frame and then sorting the data frame using this bound column. But I
can't figure out how to use this column to sort the entire data
On Mon, 2007-02-19 at 16:10 +1300, Amy Whitehead wrote:
Hi,
I am looking for a way to randomly extract a specified number of rows from a
data frame. I was planning on binding a column of random numbers to the
data frame and then sorting the data frame using this bound column. But I
can't
On Mon, 19 Feb 2007, Amy Whitehead wrote:
Hi,
I am looking for a way to randomly extract a specified number of rows from a
data frame. I was planning on binding a column of random numbers to the
data frame and then sorting the data frame using this bound column. But I
can't figure out how
amy,
here is a piece of code copied from my blog, which might answer part
of your question.
library(MASS);
data(Boston);
# DIVIDE DATA INTO TESTING AND TRAINING SETS
set.seed(2005);
test.rows - sample(1:nrow(Boston), 100);
test.set - Boston[test.rows, ];
train.set - Boston[-test.rows, ];
On