Skip to content

how to let R read different equations I write and execute it?

2 messages · czqiu, Scionforbai

#
Hello All,
I am a newcomer to R. Currently, I am trying to write an interactive code in
R to let it read the equation which I write and execute the equation in a
curve function.

For example: I want to plot curve by using: curve (equation, -2,2, n=1000)
what I want is that the R code ask me what equation I want to use (which I
know how to write this code):
then, I type for example 3*x.

then 3*x will be assigned to the 'equation' (I don't know how to do this
step)
then curve function will work to plot.

but I dont' know how I can let the equation to be read in and assigned to
equation.
I know how to do this kind of thing for numerical values but not for logical
equations.

Anyone can help out?

thanks a lot!
czqiu
#
Hi Czqiu,

short answer:
?expression
?eval
?quote
?parse
?deparse
?substitute

Bye,

Scionforbai