[Rd] error in apply help file? (PR#8118)
Uwe Ligges
ligges at statistik.uni-dortmund.de
Thu Sep 1 19:10:34 CEST 2005
gunter.berton at gene.com wrote:
> Gents: (alas, I think no ladies need to be included in the salutation)
May I ask why you think R-devel (to which R-bugs stuff is forwarded) is
only read by males?
Sounds a little bit discriminating ("Only males produce bugs, females
simply produce perfect code and do not need to read R-devel mails."??!).
Hence, I'd like to complain in this case.
Uwe Ligges
> The apply() Help file says
> "...
> If the calls to FUN return vectors of different lengths, apply returns a
> list of length dim(X)[MARGIN]. "
>
> Shouldn't that be:
>
> "If the calls to FUN return vectors of different lengths, apply returns a
> list of length prod(dim(X)[MARGIN]). "
>
> Also, might you wish to add:
>
> "This list has a dim attribute of MARGIN. That is, if VALUE is the returned
> list, dim(VALUE) = MARGIN and the values in VALUE can be accessed by the
> usual array subscripting operations."
>
> Further, it might also be useful to add the following to your Examples code:
>
> ## Example with different lengths for each call
> z <- array(1:24,dim=2:4)
> zseq <- apply(z,1:2,function(x)seq(length=max(x)))
> zseq ## displayed as a 2 x 3 matrix
> typeof(zseq) ## list
> dim(zseq) ## 2 3
> zseq[1,]
>
>
> Feel free to ignore these suggestions, of course.
>
> Cheers,
>
> -- Bert Gunter
> Genentech Non-Clinical Statistics
> South San Francisco, CA
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
More information about the R-devel
mailing list