Re: [R] Grouping Numbers

2009-03-25 Thread Jason Rupert
op. Thanks for any insights. --- On Tue, 3/24/09, Jorge Ivan Velez wrote: > From: Jorge Ivan Velez > Subject: Re: [R] Grouping Numbers > To: jasonkrup...@yahoo.com > Cc: R-help@r-project.org > Date: Tuesday, March 24, 2009, 10:28 PM > Dear Jason, > Try this: >

Re: [R] Grouping Numbers

2009-03-24 Thread Jorge Ivan Velez
Dear Jason, Try this: # First case N<-10 X<-rnorm(N) # Groups g<-rep(1:(N/n),each=10) # The result tapply(X,g,mean) For the second case, just change each=10 by each=100 and run again the code above. HTH, Jorge On Tue, Mar 24, 2009 at 10:52 PM, Jason Rupert wrote: > > Ugh...This should

Re: [R] Grouping Numbers

2009-03-24 Thread David Winsemius
Look at the seq function's help page. -- David Winsemius On Mar 24, 2009, at 10:52 PM, Jason Rupert wrote: Ugh...This should be very simple, but evidently I am not searching for the proper term. Given the below: val_size<-10 x_vals<-rnorm(val_size) I would like to group them accord

[R] Grouping Numbers

2009-03-24 Thread Jason Rupert
Ugh...This should be very simple, but evidently I am not searching for the proper term. Given the below: val_size<-10 x_vals<-rnorm(val_size) I would like to group them according to the following x_vals_mean_tmp[1]<-mean(x_vals[1:10]) x_vals_mean_tmp[2]<-mean(x_vals[11:20]) ... x_vals_mea