Я новичок в R и у меня довольно простой вопрос.
Я импортирую уравнение из файла json с именем run.json
. JSON выглядит примерно так:
"equations": {
"spec": {
"expression": "x*x*x+2*x",
"seed": 0,
"range": 100
}
}
Я загружаю в файл вот так
library("rjson")
result <- fromJSON(file = "run.json")
png('plot-spec.png', width=4, height=4, units='in', res=300)
specExpression = result$equations$spec$expression
seed = result$equations$spec$seed
range = result$equations$spec$range
# using noquote to remove quotes from the specExpression as it came in as a string
specEquation = function(x){noquote(specExpression)}
curve(
specEquation,
from=seed,
to=range,
ylab="Y",
xlab="X")
Я получаю следующую ошибку 'expr' did not evaluate to an object of length 'n'
. Не слишком уверен, что с ним делать