from_named_list {lazy.tools} | R Documentation |
Retrieve Objects from a Named List
from_named_list(nl)
nl |
A named list |
This function defines or replaces the objects in the parent frame.
mapply( assign, names(nl), nl, MoreArgs=list(envir=parent.frame()) )
# in global env.:
a=1; a1=2; b=1:2
nl=named_list( a, a1=a+3, b, 3:4, d=5:6, "E" )
rmv(a,b,temp_var4,d,E)
from_named_list( nl )
Print(a,a1,b,temp_var4,d,E)
# in a function:
f <- function(){
nl=list(a=1,b=2)
from_named_list( nl )
Print("in function f:",a,b)
}
f()