Skip to content
Prev 32729 / 398525 Next

parse on left hand side of R assignment

On Sat, 31 May 2003, Paul E. Johnson wrote:

            
In this particular case you can just use

myList[[varName]]<-aColumn.

I don't think you can (easily) use assign, despite the suggestion -- it
doesn't dispatch assignment methods.

If you wanted to do something of this sort for which the above didn't work
you could also learn about substitute()
  eval(substitute(myList$newColumn<-aColumn),
     list(newColumn=as.name(varName)))
as an alternative to parse().

	-thomas