Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 8/24/14, 11:07 PM, "PO SU" <rhelpmaillist at 163.com> wrote:
>
>
>Dear rusers,
>
> As we know, there are a lot of environments in the search() path,
>such as .Golbalenv and package:base .
>And i can just use .Golbalenv$a ,.Golbalenv$b to use the virable, but
>i must use as.envrionment("package:base") to find virable, i feel it not
>very convenient.
>
>
>For example, when i use the following codes to add a new env into the
>search() path.
>
>
>
>> tmp<-attach(NULL,name="new_name")
>> assign("a",2,envir=as.environment("new_name"))
>> a
>[1] 2
>> as.environment("new_name")$a
>[1] 2
> I must always convert the name to the environment, How can i just use
>the following form:
>
>
>
>> tmp<-attach(NULL,name="new_name")
>> assign("a",2,envir=new_name) #like using .GlobalEnv
>> a
>[1] 2
>> new_name$a
>
>[1] 2
>
>
>
>
>
>
>
>--
>
>PO SU
>mail: desolator88 at 163.com
>Majored in Statistics from SJTU
>______________________________________________
>R-help at r-project.org 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.