R/meta_grades.R

Defines functions meta_grades

Documented in meta_grades

#' artlookR grades metadata
#'
#' There is only one set of \code{grades} used across the entire artlookR platform (i.e., this table is listed in the
#' \code{public} schema). Because of that there is no requirement in this function to identify a \code{comm_name}.
#' @return A list with the label names, levels, artlookR id numbers for each \code{grades} value used in artlookR.
#' @details * You will need to run the \code{connection.R} script and create a connection object named \code{myconn} for this script to run.
#' @examples meta_grades()
#' @export
meta_grades <- function(...){

  temp <- tbl(myconn, in_schema("public", "grades")) %>%
    arrange(id) %>%
    collect

  output <- list(label = case_when(is.na(temp$display_name) ~ str_to_title(str_replace_all(temp$name, "_", " ")),
                                   TRUE ~ temp$display_name),
                 level = temp$name,
                 id = temp$id)
  output

}
Ingenuity-Inc/artlookR documentation built on May 18, 2022, 12:33 a.m.