Re: [R] Using assign with mapply

2013-12-20 Thread Greg Snow
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

Re: [R] Using assign with mapply

2013-12-19 Thread Julio Sergio Santana
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

Re: [R] Using assign with mapply

2013-12-18 Thread Greg Snow
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

Re: [R] Using assign with mapply

2013-12-16 Thread Julio Sergio Santana
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

Re: [R] Using assign with mapply

2013-12-10 Thread Julio Sergio Santana
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"),

Re: [R] Using assign with mapply

2013-12-06 Thread David Winsemius
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