[R] function environment
Matthias Braeunig
mb.atelier at web.de
Fri Jun 2 17:41:43 CEST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
how can I automatically access the functions that I loaded into a
separate environment?
> save(A,B,file="myfun.r")
> load("myfun.r",envir=(ENV<-new.env()))
> ls(ENV)
[1] "A" "B"
?"[" turned up that I can access the functions via
> ENV$A
function ()
{
}
> ENV$A()
NULL
Now, how can they be included in the search() path??
attach() as for data.frames does not work...
Furthermore, if I change a functions environment to ENV, why is it not
listed with ls(ENV)?? Instead it still lives in .GlobalEnv
> C<-function(){}
> environment(C)<-ENV
> ls(ENV)
[1] "A" "B"
> C
function(){}
<environment: 0x9cbbb58>
> ENV
<environment: 0x9cbbb58>
Thanks folks!
I enjoy reading and learning from r-help list!
M
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
iD8DBQFEgFw2XjamRUP82DkRAooRAJ9sxwERwfXF3l7pssZ081sMC1+nigCgqAPM
OkA1tNJg6MN3l0PQFrwBlIE=
=tGFq
-----END PGP SIGNATURE-----
More information about the R-help
mailing list