[R] fun.aggregate=mean in reshape

[Ricardo Rodriguez] Your XEN ICT Team webmaster at xen.net
Tue Feb 12 09:23:48 CET 2008


Hi all,

We are facing a problem while introducing ourselves to Reshape package 
use. Melt seems to work fine, but cast fails when we use mean as 
fun.aggregate. As you see here, length and sum work fine, but mean 
throws this same error whatever dataset we use.

 > cast(aqm, month ~ variable, length)
  month ozone solar.r wind temp
1     5    26      27   31   31
2     6     9      30   30   30
3     7    26      31   31   31
4     8    26      28   31   31
5     9    29      30   30   30
 > cast(aqm, month ~ variable, sum)
  month ozone solar.r  wind temp
1     5   614    4895 360.3 2032
2     6   265    5705 308.0 2373
3     7  1537    6711 277.2 2601
4     8  1559    4812 272.6 2603
5     9   912    5023 305.4 2307
 > cast(aqm, month ~ variable, mean)
Error in get(as.character(FUN), mode = "function", envir = envir) :
  variable "fun" of mode "function" was not found
 >


Our environment:

 > version
               _                          
platform       i386-apple-darwin8.10.1    
arch           i386                       
os             darwin8.10.1               
system         i386, darwin8.10.1         
status                                    
major          2                          
minor          6.2                        
year           2008                       
month          02                         
day            08                         
svn rev        44383                      
language       R                          
version.string R version 2.6.2 (2008-02-08)


 > installed.packages()

reshape    "reshape"    
"/Library/Frameworks/R.framework/Resources/library" "0.8.0"   
NA            NA


Please, could you help use to work out this issue? Thanks!

-- 
Ricardo Rodríguez
Your XEN ICT Team



More information about the R-help mailing list