Reputation: 321
I want to pass a line of code in textInput function, like suppose I write list(a = c("b", "c"))
in textInput. But textInput would take it as a character string.
Is there any way to do it?
Upvotes: 2
Views: 41
Reputation: 24790
You can use eval
and parse
from base R. Please note that it can be dangerous to evaluate user defined code, so think twice.
string <- 'list(a = c("b", "c"))'
eval(parse(text = string))
#$a
#[1] "b" "c"
Upvotes: 1