|
R preprocessor allows you to use R language directly instead of parameter of JavaScript functions.
R script should be located in special block inside JavaScript which begins from
#R(...)
and ends with
#end
In next table possible variants presented with equivalent JavaScript code:
|
With preprocessor
|
Without preprocessor
|
|
r = R.rserve();
#R(r)
c = rnorm(50);
#end
|
r = R.rserve();
r.eval("e;c = rnorm(50)"e;);
|
|
r = R.rserve();
#R(r.voidEval(R))
c = rnorm(50);
#end
|
r = R.rserve();
r.voidEval("e;c = rnorm(50)"e;);
|
|
r = R.rserve();
#R(rplot(r,R))
c = rnorm(50);
hist(c);
#end
|
r = R.rserve();
rplot(r,"e;c = rnorm(50);hist(c);"e;);
|
|