How do I plot a function formatted as a string in R -


i building application rapache , code in r receiving post data. 1 of post datas post$f string- "sin(x)". there way put plot function successfully?

thanks!

fun <- "sin(x)" plot(function(x) eval(parse(text=fun))) 

but not recommend. eval(parse(...)) dangerous, , arbitrary user input web site gaping security hole.

# plotting function above delete in global workspace fun <- "{rm(list=ls(pos=1),pos=1); x}" # don't didn't warn you! 

or using system() more bad things.


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -