We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
...is dividing the large function into methods for new generic evalArg:
evalArg
evalArg <- function(arg, ...) { UseMethod("evalArg") } evalArg.default <- function(arg, env, enc) { if (is.list(arg)) arg <- as.list(arg) return(arg) stop("No method found for object having class(es) ", paste0(class(arg), collapse = ", "), " for generic evalArg.") } evalArg.name <- function(arg, env, enc) { d <- deparse(arg) out <- try(get(d, envir = env, inherits = FALSE), silent = TRUE) if (inherits(out, "try-error")) { out <- try(get(d, envir = enc, inherits = FALSE), silent = TRUE) } if (inherits(out, "try-error")) { stop("Could not find object ", d, ".") } out <- list(out) names(out) <- d out } evalArg.call <- function(arg, env, enc) { out <- eval(arg, env = env, enc = enc) if (is.list(out)) { out <- as.list(out) } else if (mode(out) %in% c("numeric", "character") || is.vector(out)) { out <- list(out) names(out) <- paste0(deparse(arg), collapse = "") } out } evalArg.character <- function(arg, env) { se <- substitute(env) out <- try({ get(arg, envir = as.environment(env), inherits = FALSE) }, silent = TRUE) if (inherits(out, "try-error")) { stop("Could not find object ", arg, ".") } out <- list(out) names(out) <- arg out } evalArg.formula <- function(arg, env) { rhsc <- attr(terms(f), "term.labels") rhsl <- lapply(rhsc, function(stri) parse(text = stri)[[1]]) names(rhsl) <- rhsc rhsl <- lapply(rhsl, eval, env = env, enc = attr(arg, ".Environment")) ## TODO: handle : operator as if x and y are both factors rhsl }
The text was updated successfully, but these errors were encountered:
wrote mini functions towards #108
3eaeb35
WetRobot
No branches or pull requests
...is dividing the large function into methods for new generic
evalArg
:The text was updated successfully, but these errors were encountered: