[Rd] [R] variance/mean

Wacek Kusnierczyk Waclaw.Marcin.Kusnierczyk at idi.ntnu.no
Wed Apr 1 10:39:53 CEST 2009


Martin Maechler wrote:
>
> Your patch is basically only affecting the default  
> method = "pearson". For (most) other cases, 'y = NULL' would
> still remain  *the* way to save computations, unless we'd start
> to use an R-level equivalent [which I think does not exist] of
> your C  trick   (DATAPTR(x) == DATAPTR(y)).
>
>   

yes, my patch was constrained to the c code, but i don't think it would
be particularly difficult to fix the relevant r-level code as well.  i
did think about it, but didn't want to invest more time in this until
(or unless) someone would respond.  (thanks for the response.)

> Also, for S- and R- backcompatibility reasons, we'd need to
> continue allowing  y = NULL (as your patch would, too), 

only in its current for -- indeed, the (unimplemented) intention was to
detach from the old misdesign, and fix everything so that y=x by default
anywhere.

> so
> currently I think this whole idea -- as slick as it is, I
> learned something!  --  
> does not make sense applying here.
>   

i think it does, because the current state is somewhat funny, including
both the difference in performance between var(x) and var(x,x) (with x
being a matrix), and the respective comment in ?var.

>     > the attached patch suggests modifications to src/main/cov.c and
>     > src/library/stats/man/cor.Rd.
>
> BTW: since you didn't (and shouldn't , because of method != "pearson" !) 
>  change the R code, 

i would suggest it be done, though.

> the docs  \usage{.} part should not have been
>  changed either ! 
>   

indeed, the change in the docs didn't match what i *have* actually fixed
in the code.

>  and as I mentioned: using 'y = NULL' in the function call must
>   

*MUST* ?

>  continue to work, hence should also be documented as
>  possibility
>  ==>  the docs would not really become more clear, I think 
>   

no, of course, without the change in r code having the docs say y=x by
default would be a nonsense.  but again, this was a start, not a
complete modification (and i admit i failed to acknowledge this).

vQ



More information about the R-devel mailing list