[R] functions, `...' and .Rprofile

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Mon Jul 30 23:27:54 CEST 2001


mmiller3 at iupui.edu (Michael A. Miller) writes:

> I'm experiencing some confusion with the ellipsis argument
> (...).  
> 
> In my .Rprofile, I have the following functions:
> 
>    stderr <- function(x, ...) {
>      sqrt( var(x, ...) / length(x) )
>    }
>    se <- stderr
...
> If I use stderr instead, I don't get that error:
> 
>    > tapply( Diameter, factor(Region), stderr, na.rm=TRUE )
>              I          II         III          IV           V 
>    0.005167949 0.004405095 0.006588870 0.006633189 0.001857812 

I know that's not what you were asking, but you're not getting
the correct result either... You'd need to divide by sum(!is.na(x))
rather than length(x).

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list