expression, parse(), eval()で数式を
hogeEx<-parse(text="2/3*x^3+sqrt(x)-x^4*cos(x)") evalWithVal<-function(x,exp){ eval(exp) } x<-seq(from=0,to=10,length.out=101) plot(x,evalWithVal(x=x,exp=hogeEx),type="l")
hogeEx<-parse(text="2/3*x^3+sqrt(x)-x^4*cos(x)") evalWithVal<-function(x,exp){ eval(exp) } x<-seq(from=0,to=10,length.out=101) plot(x,evalWithVal(x=x,exp=hogeEx),type="l")