Skip to content

parse on left hand side of R assignment

1 message · Thomas Lumley

#
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