Will this do it for you:
> Bill <- 1:100 # test data
> # partition
> Bill.p <- split(Bill, rep(1:10, each=10))
> Bill.p
$`1`
[1] 1 2 3 4 5 6 7 8 9 10
$`2`
[1] 11 12 13 14 15 16 17 18 19 20
$`3`
[1] 21 22 23 24 25 26 27 28 29 30
$`4`
[1] 31 32 33 34 35 36 37 38 39 40
$`5`
[1] 41 42 4
One possibility is:
x <- ceiling((1:100)/10)
aggregate(var1,by=list(x),mean)
--- On Wed, 4/6/08, William Pepe <[EMAIL PROTECTED]> wrote:
> From: William Pepe <[EMAIL PROTECTED]>
> Subject: [R] Question about subsetting data
> To: r-help@r-project.org
> Received: Wed
I have a data set(Bill) of with 1 variable (var1), with 100 obs that are in
ascending order. I want to sample every 10 observations and save them in 10
different groups such as
Group1 is obs 1-10
Group 2 is obs-11-20
and so on.
First step is to subset them into the 10 groups, then calc
3 matches
Mail list logo