[R] Scoping bug!?

Marcus Eger marcus.eger at physik.uni-marburg.de
Thu Dec 17 18:12:34 CET 1998


Thomas Lumley wrote:

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

This is what I get (direct copy from emacs window):

> funny<-function(a1,a2,a3) {
+ x<-rnorm(50)
+ a<-locfit(~x)
+ print(a)
+ plot(a)
+ }
> objects()
 [1] "Pc"         "brf.info"   "brf.info2d" "brf.infoD"  "funny"
 [6] "ix"         "mm"         "xrange"     "xyrange"    "yrange"
> funny()
Error: Object "x" not found
>

Marcus Eger

--
+------------------------------------------
| Marcus Eger
| Philipps Universitaet Marburg
| Fachbereich Physik AG Neurophysik
| Renthof 7
| 35032 Marburg
| Tel. +49 6421 284169
| Fax  +49 6421 287034
+------------------------------------------
| E-Mail: marcus.eger at physik.uni-marburg.de
+------------------------------------------



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