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 -

javascript - Preserving URL fragment through CAS sign-on -

asp.net mvc - Implementing normal user/pass, Twitter & Facebook auth -