R/meta_years.R

Defines functions meta_years

Documented in meta_years

#' artlookR years metadata
#'
#' @param comm_name The community name as recognized by artlookR
#' @return A list with:
#' * \code{current_id} the artlookR id for the community's current year.
#' * \code{current_label} the display name of the community's current year.
#' * \code{label} the artlookR id for each school year created for this community.
#' * \code{level} the display name for each school year created for this community.
#' @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_years("chicago")
#' @export
meta_years <- function(comm_name){

  temp <- tbl(myconn, in_schema(comm_name, "school_years")) %>%
    select(id, number, current) %>%
    collect

  output <- list(current_id = temp %>% filter(current == TRUE) %>% select(id) %>% as.numeric(.),
                 current_label = temp %>% filter(current == TRUE) %>% select(number) %>% pull,
                 label = temp$number,
                 level = temp$id)

  output

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