I'm trying to round an output from a simple by() function in R. This is what I have...
> by(glaciers[,1:3],glaciers$activity.level,mean)
glaciers$activity.level: Active
       aspect  sun.duration      latitude 
-9.444444e+00  1.771778e+03  3.247643e+09 
-------------------------------------------
glaciers$activity.level: Inactive
      aspect sun.duration     latitude 
1.041667e+01 2.067583e+03 4.048301e+09 
-------------------------------------------
glaciers$activity.level: Relict
      aspect sun.duration     latitude 
1.766667e+01 2.168000e+03 2.759283e+09
How can I get my output to round to say 5 decimal places, and still keep the factors? I tried round(by(glaciers[,1:3],glaciers$activity.level,mean),5) but get an error Non-numeric argument to mathematical function.