Re: [R] Similar question about subsetting data

From: Jorge Ivan Velez <jorgeivanvelez_at_gmail.com>
Date: Tue, 03 Jun 2008 23:53:55 -0400

Dear William,

Following Jim Holtman's solution to your previous post, you can do something similar to

Bill <- 1:100 # test data
Bill.p <- split(Bill, rep(1:10, each=10)) sapply(Bill.p, function(x) mean(x)/0.8)
1 2 3 4 5 6 7 8 9 10   6.875 19.375 31.875 44.375 56.875 69.375 81.875 94.375 106.875 119.375

HTH, Jorge

On Tue, Jun 3, 2008 at 10:36 PM, William Pepe <williampepe_at_hotmail.com> wrote:

>
> This is just a slight modification of a question I asked earlier. Thanks to
> all the responders.
>
> 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 ....
> Subset data into the 10 groups, then calculate the mean/0.8 of var1 for each
> of the 10 groups.
> The mean/0.8 is the modification. Thanks.
> _________________________________________________________________
> It's easy to add contacts from Facebook and other social sites through Wi
> https://www.invite2messenger.net/im/?source=TXT_EML_WLH_LearnHow
> [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>

        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 04 Jun 2008 - 03:56:51 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 04 Jun 2008 - 04:30:38 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive