Now I have data
dat <- data.frame(y,x1,x2)
there are about 200 rows.
And I want to partition this data by row number
like 1 to 150 and 150 to 200
How can I do this?
Now I have data
dat <- data.frame(y,x1,x2)
there are about 200 rows.
And I want to partition this data by row number
like 1 to 150 and 150 to 200
How can I do this?
As mentioned by @etienne use [
dat <- data.frame("y" = 1:200 , "x1" = rnorm(200), "x2" = rnorm(200))
dat1 <- dat[1:150,]
dat2 <- dat[151:200,]