[R] Aggregate function for comparison stats

Neil Davis neda at dtu.dk
Thu Apr 26 15:29:23 CEST 2012


I have a data.frame which contains timeseries from several different 
locations, which I want to compare against each other for example 
calculating RMSE, or normalized mean bias of each location against the 
others. An example of this is the cor function where I can put in a 
data.frame and get the correlation of each location compared to the 
others in the data.frame eg.

Is there any generic way of getting this for other functions, such as 
the aggregate or lapply functions? I have read their documentation, but 
was unclear as to how I might use them to get a matrix like the cor 
function. I could do this using a pair of loops, but was hoping there 
might be a more general way of creating such a matrix of any comparison 

Thank you for your help,


Neil Davis
DTU Wind Energy

Technical University of Denmark

Department of Wind Energy
Risø Campus Frederiksborgvej 399, P.O. Box 49
Building 125
4000 Roskilde
Direct +45 46775067
neda at dtu.dk <mailto:neda at dtu.dk>
www.dtu.dk <http://www.dtu.dk>

More information about the R-help mailing list