[R] Scoping bug!?

Thomas Lumley thomas at biostat.washington.edu
Thu Dec 17 18:03:30 CET 1998


On Thu, 17 Dec 1998, Marcus Eger wrote:

> Hello - any suggestions?!
> 
> "fun" <-  function (a1,a2,a3)  {
> ...
>  x<-rnorm(50)
>  a<-locfit(~x)
> ...
> }
> 
> does not work, (Error: Object "x" not found) but

Can we have more details: I get (current release version,
sun-sparc-solaris2.6)

R> f
function (a1, a2, a3) 
{
    x <- rnorm(50)
    a <- locfit(~x)
    a
}
R> f(1,2,3)
               x     mu hat        h  ||l(x)||
[1,] -2.44357492 0.03592551 3.043734 0.6058943
[2,]  3.96539931 0.00879119 4.658834 0.8786258
[3,]  0.76091219 0.25311904 1.595055 0.2680011
[4,] -0.84133136 0.21789582 1.458504 0.2904340
[5,] -1.64245314 0.13832984 2.242613 0.3031374
[6,] -0.04020959 0.36128047 1.348361 0.2587580
[7,]  2.36315575 0.05749231 3.056590 0.3636520
[8,]  1.56203397 0.12838223 2.296590 0.2954230


Thomas Lumley
Assistant Professor, Biostatistics
University of Washington, Seattle

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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