[R] gsummary

Douglas Bates bates at stat.wisc.edu
Thu Aug 3 20:43:12 CEST 2006


The gsummary function was intended to apply a summary function to each
column in each of the groups of observations.  The (implicit)
definition of a summary function is that it produces a scalar from a
vector.  (See the groupings of functions in Table A.1, p. 472 of
"Statistical Models in S", a.k.a. "The White Book".)

I don't think you need to use gsummary for your application.  You may
be able to use tapply or a combination of split and lapply instead.


On 8/3/06, Mike Saunders <mike_saunders at umenfa.maine.edu> wrote:
> Could someone give me a hand with the format of the gsummary function?  Basically, I have a large set of xyz coordinates generated by LiDAR data (>37 million points) and I am trying to derive various summary statistics on the z-coordinates by a grid cell.  I wrote a function to do this by creating factors from the x- and y- coordinates and then using gsummary.  However, I want the function to calculate BOTH the max z-value in a grid cell and the number of z-values in that cell.  gsummary is supposed to be able to use a list a functions as input to FUN, but I am having trouble coding it correctly.  Here is what I came up to so far.
>
> gr<-gsummary(xyz.packet,FUN=list(numeric=max,numeric=length),omitGroupingFactor=T,form=~X/Y)
>
> The help for the function gives no examples using multiple functions as a FUN value, so the help pages haven't been overly useful in this case.
>
> Thanks in advance,
> Mike
>
> Mike R. Saunders
> Forest Biometrician
> Cooperative Forest Research Unit
> University of Maine
> 5755 Nutting Hall
> Orono, ME  04469-5755
>
> 207-581-2763 (O)
> 207-581-2833 (F)
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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