How Can I Execute a String Expression?
On 13/06/17 13:55, Donald Macnaughton wrote:
I have the string ggstr that I've built with string manipulation: ggstr = "ggplot(df1, aes(x,y)) + geom_smooth(se=FALSE, span=0.01)" Assuming df1 is properly defined, this string will execute properly if I submit it manually without the quotes. How can execute the command as a string, so that I can run it repeatedly (with minor modifications) in a loop? Presumably, it would be something like: execute(ggstr) Thanks for your help.
eval(parse(text = ggstr)) cheers, Rolf Turner
Technical Editor ANZJS Department of Statistics University of Auckland Phone: +64-9-373-7599 ext. 88276