2011-05-08から1日間の記事一覧

expression, parse(), eval()で数式を

R

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")

Rで数式に値を代入