I have a dataframe containing 100 rows. If I want to extract the first 10 rows
in one dataframe and the rest of them
in another dataframe. So the code is
df1 <- df[1:10, ]
df2 <- df[11:100, ]
But, if I want to extract the rows from 11 to 20
in one dataframe and the rest of the rows (1-10 and 21-100)
in another dataframe then how I have to change the code?
df1 <- df[11:20, ]
df2 <-
sample dataframe
df <- data.frame(items=sample(LETTERS,100,replace=TRUE),
quantity=sample(1:100,100,replace=TRUE),
price=sample(100:1000,100,replace=TRUE))