[R] list -> environment coercion

Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.ac.be
Tue Nov 9 17:34:22 CET 2004


Hi Valery,

a simple way to do it might be the following:

lis <- list(a=10, b=20, d="x")
e1 <- new.env()
for(i in 1:length(lis)) assign(names(lis)[i], lis[[i]], envir=e1)
####
d
get("d", env=e1)


I hope it helps.

Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/396887
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat/
     http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm


----- Original Message ----- 
From: "Valery A.Khamenya" <vak at biovision-discovery.de>
To: <r-help at stat.math.ethz.ch>
Sent: Tuesday, November 09, 2004 4:56 PM
Subject: [R] list -> environment coercion


> Hi all,
>
> there is "environment->list" coercion, i.e. as.list.environment.
>
> Is there any "list->environment" coercion?
>
> thank you.
> --
> Valery.
>
> ______________________________________________
> 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
>




More information about the R-help mailing list