[R] Remove quotes from a string to use in a variable call

dadrivr dadrivr at gmail.com
Tue Mar 20 17:10:32 CET 2012


I have a string that I want to use in a variable call.  How can I remove the
quotes and/or the string properties of the string to use it in a variable

Here's an example:

fm2 <- lme(distance ~ age, data = Orthodont, random = ~ 1)

I want to update the above regression to include new predictors according to
what is in a string:

predictors <- "age + Sex"
update(fm2,fixed=distance ~ age + Sex) #this works
update(fm2,fixed=distance ~ noquote(predictors)) #this doesn't work

Any help would be greatly appreciated.  Thanks!

View this message in context: http://r.789695.n4.nabble.com/Remove-quotes-from-a-string-to-use-in-a-variable-call-tp4489370p4489370.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list