How can I run command which came from textInput() ?

23 views
Skip to first unread message

peter...@gmail.com

unread,
Sep 24, 2016, 12:46:38 AM9/24/16
to Shiny - Web Framework for R
For example, as you can see below capture image, I just want to run linear regression command directly from the "Tunning Model textInput" box.  
In this case, as I know, I can retrieve the value of the textInput box with  " Input$tunningModel " form,

but it returns just a character string, not a real command that can be run at Rstudio directly. 
How can I solve this problem? 
Thank you so much in advance for your kind help.


I receive the 

Dean Attali

unread,
Sep 24, 2016, 4:23:55 AM9/24/16
to Shiny - Web Framework for R
I think something like `eval(parse(text = input$text))` might do what you want. But that's very dangerous, I would highly discourage you from allowing this functionality in a public facing app, because it means that anybody will be able to run arbitrary commands against your server, which will make your hosting machine prone to attack

peter...@gmail.com

unread,
Sep 24, 2016, 10:16:20 AM9/24/16
to Shiny - Web Framework for R
I appreciate your kind advice !
Reply all
Reply to author
Forward
0 new messages