I have a large data frame which I would like to break down into smaller data frames. I know which rows I would like to split up (i.e I want to separate rows 1 - 33, 34 - 60, ....). I know I have to use subset(), but I cant seem to find the specific parameters.
Asked
Active
Viewed 188 times
1
-
This is pretty basic stuff - try reading through an R tutorial to get your fundamentals down. [Quick-R](http://www.statmethods.net/) is a good one; [here's the page for this specific question](http://www.statmethods.net/management/subset.html). – Matt Parker Jun 17 '13 at 21:11
1 Answers
1
If you mean from the 1st to the 33th row, just do this
df[1:33,]
as an example:
> df<-data.frame(A=LETTERS[1:10], B=c(1:10))
> df
A B
1 A 1
2 B 2
3 C 3
4 D 4
5 E 5
6 F 6
7 G 7
8 H 8
9 I 9
10 J 10
> df[1:3,]
A B
1 A 1
2 B 2
3 C 3

nigmastar
- 470
- 5
- 15