Visitar URL original
Create helper function for evaluating user params · Issue #16 · USEPA/rExpertQuery · GitHub
Skip to content

Create helper function for evaluating user params #16

Open

Description

@hillarymarler

Create internal helper function to eval user params:

#create df of user entered params
get.user <- as.list(match.call()[-1])

evaluate user params

user.evals <- lapply(get.user, eval, envir = parent.frame())

create df and format params

user.params <- as.data.frame(t(user.evals), stringsAsFactors = FALSE) %>%
tidyr::pivot_longer(everything(), names_to = "param") %>%
EQ_FormatParams()

remove intermediate objects

rm(get.user, user.evals)

Activity

  1. hillarymarler commented on Mar 27, 2025

    @hillarymarler
    CollaboratorAuthor

    #' #' Evaluate user supplied params within exported rExpertQuery function (internal function)
    #' #' This draft function does not work yet, but will ultimately be used in EQ_TMDLS, EQ_Sources,
    #' #' EQ_CatchCorr, EQ_AUsMLs, EQ_AssessmentUnits, EQ_Assessments, EQ_ActionsDocuments, and
    #' #' EQ_Actions.
    #' #'
    #' #' @PARAM matchcall The match.call()[-1] result from within the function.
    #' #'
    #' #' @return A data frame of user params with all values evaluated.
    #' #'
    #' #' @Keywords internal
    #' #'
    #' EQ_EvalUserParams <- function(matchcall) {
    #' user.evals <- lapply(matchcall, eval, envir = parent.frame())
    #'
    #' user.params <- as.data.frame(t(user.evals), stringsAsFactors = FALSE) %>%
    #' tidyr::pivot_longer(everything(), names_to = "param")
    #'
    #' rm(user.evals)
    #'
    #' return(user.params)
    #' }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions