R/meta_disciplines.R

Defines functions meta_disciplines

Documented in meta_disciplines

#' artlookR disciplines metadata
#'
#' There is only one set of \code{disciplines} 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{disciplines} value used in artlookR.
#' @details * There is, at present, no \code{display_name} variable in the table.
#'
#'  * You will need to run the \code{connection.R} script and create a connection object named \code{myconn} for this script to run.
#'
#'  * This function changes the label for missing disciplines data from the artlookR default of "None" to "No Discipline Provided".
#' @examples meta_disciplines()
#' @export
meta_disciplines <- function(...){

  temp <- tbl(myconn, in_schema("public", "disciplines")) %>%
    arrange(position) %>%
    collect

  output <- list(label = str_to_title(str_replace_all(temp$name, "_", " ")) %>% str_replace(., "None", "No Discipline Provided"),
                 level = temp$name,
                 id = temp$id)

  output

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