[R] summarise subsets of a vector

Jessica Streicher j.streicher at micromata.de
Wed Jan 23 13:12:37 CET 2013


Or maybe

x<-matrix(test,nrow=10)
apply(x,2,mean)


On 23.01.2013, at 00:09, Wim Kreinen wrote:

> Hello,
> 
> I have vector called test. And now I wish to measure the mean of the first
> 10 number, the second 10 numbers etc
> How does it work?
> Thanks Wim
> 
>> dput (test)
> c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.71, 0.21875, 0, 0.27375, 0.26125,
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.84125,
> 0.0575, 0.92625, 0.12, 0, 0)
> 
> 	[[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.



More information about the R-help mailing list