R/read_grades.R

Defines functions read_grades

Documented in read_grades

##' Reads grades data file
##'
##' @description Currently this will only read .csv files - will implement .xls and .xlsx later
##' @param fn filename for grade
##' @param id.col column for ids (usually last name)
##' @param raw.grade.col column for raw grades
##' @param suppress.messages suppress read_csv messages
##' @export

read_grades <- function(fn, id.col, raw.grade.col, adj.grade.col = NULL, suppress.messages = TRUE) {
  # Ultimately put in a switch statement to use readxl::whatever
  if(suppress.messages) {
    d <- suppressMessages(readr::read_csv(fn))
  } else {
    d <- readr::read_csv(fn)
  }

  # d <- as_grade_list(d, id.col = rlang::enquo(id.col),
  #                    raw.grade.col = rlang::enquo(raw.grade.col),
  #                    adj.grade.col = rlang::enquo(adj.grade.col))
  d <- as_grade_list(d, id.col = id.col,
                     raw.grade.col = raw.grade.col,
                     adj.grade.col = adj.grade.col)


  d
}
adsteen/gradr documentation built on Dec. 18, 2017, 4:45 a.m.