[R] simple averaging question?

Moshe Olshansky m_olshansky at yahoo.com
Fri Nov 2 00:31:02 CET 2007


If x is your vector, one possibility is:

y <- matrix(x,nrow=60)
z <- apply(y,2,mean)

--- Jeff Miller <jeffmiller at alphapoint05.net> wrote:

> Hi all,
> 
>  
> 
> Suppose I have a column vector of 600 measurements
> taken in 1s intervals.
> 
>  
> 
> What I want is a new vector with the averages for
> each min (so there would
> be 10 entries).
> 
>  
> 
> Is there an efficient way to do this? I’ve been
> doing it with a ‘for’ loop
> but something tells me there is a simple command
> that is more efficient.
> 
>  
> 
> Jeff
> 
>  
> 
> 
> Internal Virus Database is out-of-date.
> Checked by AVG Free Edition. 
> 
> 3:09 PM
>  
> 
> 	[[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