Trying to understand environments is not for the faint of heart. If
lists do what you want then I would stick with a list and not worry
about the environments. Most of the time that you deal with
environments everything happens automatically behind the scenes and
you don't need to worry about the
Greg Snow <538280 gmail.com> writes:
>
> The take home message that you should be learning from your struggles
> is to "Not Use The 'assign' Function!" and "Do Not Use Global
> Variables Like This".
>
> R has lists (and environments) that make working with objects that are
> associated with eac
The take home message that you should be learning from your struggles
is to "Not Use The 'assign' Function!" and "Do Not Use Global
Variables Like This".
R has lists (and environments) that make working with objects that are
associated with each other much simpler and fits better with the
function
Julio Sergio Santana gmail.com> writes:
>
> I have a data frame whose first colum contains the names of the variables
> and whose second colum contains the values to assign to them:
>
>: kkk <- data.frame(vars=c("var1", "var2", "var3"),
> vals=c(10, 20, 30), stringsAs
David Winsemius comcast.net> writes:
> So what happens if you try this:
>
> mapply(assign, kkk$vars, kkk$vals, MoreArgs = list(envir = .GlobalEnv)
>
Yes, it works in certain situations, as well as the equivalent code:
kkk <- data.frame(vars=c("var1", "var2", "var3"),
On Dec 6, 2013, at 11:27 AM, Julio Sergio Santana wrote:
> I have a data frame whose first colum contains the names of the variables
> and whose second colum contains the values to assign to them:
>
> : kkk <- data.frame(vars=c("var1", "var2", "var3"),
> vals=c(10, 20, 30
6 matches
Mail list logo