[R] simple averaging question?
     (Ted Harding) 
    Ted.Harding at manchester.ac.uk
       
    Thu Nov  1 23:29:12 CET 2007
    
    
  
On 02-Nov-07 00:12:19, Jeff Miller 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? Ive been doing it
> with a "for" loop but something tells me there is a simple
> command that is more efficient.
A simple-minded thought is (constructing first such a vector S):
S<-rnorm(600)
colMeans(matrix(S,nrow=60))
 [1] -0.0999271  0.1622274  0.2044960 -0.1503812 -0.0224353
 [6]  0.1133577  0.2567317 -0.2510650 -0.1219953  0.0001626
Hoping this helps!
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 01-Nov-07                                       Time: 23:29:09
------------------------------ XFMail ------------------------------
    
    
More information about the R-help
mailing list