[R] A question about R environment
wangtong at usc.edu
Tue Jan 9 09:58:14 CET 2007
Thanks a lot for your response, but it is strange that when I do attach() , I got the follow error:
Error in attach(e) : attach only works for lists and data frames
Any suggestions on this?
----- Original Message -----
From: Henrik Bengtsson <hb at stat.berkeley.edu>
Date: Monday, January 8, 2007 10:40 pm
Subject: Re: [R] A question about R environment
To: Gabor Grothendieck <ggrothendieck at gmail.com>
Cc: Tong Wang <wangtong at usc.edu>, R help <r-help at stat.math.ethz.ch>
> sourceTo() in R.utils will allow you to source() a file into an
> On 1/9/07, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:
> > Try this:
> > > e <- new.env()
> > > e$f <- function(x)x
> > > attach(e)
> > > search()
> >  ".GlobalEnv" "e" "package:stats"
> >  "package:graphics" "package:grDevices" "package:utils"
> >  "package:datasets" "package:methods" "Autoloads"
> >  "package:base"
> > > f
> > function(x)x
> > On 1/8/07, Tong Wang <wangtong at usc.edu> wrote:
> > > Hi all,
> > >
> > > I created environment "mytoolbox" by : mytoolbox <-
> new.env(parent=baseenv())> > Is there anyway I put it in the search
> path ?
> > >
> > > If you need some background :
> > > In a project, I often write some small functions, and load
> them into my workspace directly, so when I list the objects
> > > with ls(), it looks pretty messy. So I am wondering if it is
> possible to creat an environment, and put these tools into
> > > this environment. For example, I have functions fun1(),
> fun2() ...... and creat an environment mytoolbox which
> > > contains all these functions. And it should be somewhere in
> the search path: ".GlobalEnv" "mytoolbox"
> "package:methods" ........
> > >
> > > ______________________________________________
> > > R-help at stat.math.ethz.ch mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide http://www.R-
> > > and provide commented, minimal, self-contained, reproducible code.
> > >
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html> and provide commented, minimal, self-contained,
> reproducible code.
More information about the R-help