evaluate = function(){
value <- tryCatch(
{
safe_envir <- c(self$data, self$arithmetic_operators)
#value <-eval(parse(text=self$equation), envir=safe_envir)
value <-eval(self$eq, envir=safe_envir)
},
error=function(cond) {
# if no. of errors not exceeded,
self$numnull <- self$numnull + 1
if (self$numnull <= 5) {
message(paste("Could not evaluate"))
message(cond)
}
# Choose a return value in case of error
value <- self$defaultvalue
}
)
if (typeof(value) == 'closure') {
# Choose a return value in case of error
self$numnull <- self$numnull + 1
if (self$numnull <= 5) {
message(paste("Eval returned a function - check equation names for reserved words with undefined local values"))
message(self$data)
}
value <- self$defaultvalue
}
return(value)
}
Equation Evaluation
References
Objects