R/get_max_col.R

Defines functions get_max_col

Documented in get_max_col

#' RM2C2: Scoring, Summarizing

#' @name get_max_col
#' @export
get_max_col <- function(df, colstring = NA) {
  regexp <- "[[:digit:]]+"
  max.item <- df %>% 
    select(contains(colstring)) %>%
    gather(variable, value) %>%
    mutate(max_items = str_extract(variable, regexp)) %>%
    summarise(max = max(max_items))
  return(as.numeric(max.item))
}
nelsonroque/RM2C2 documentation built on Dec. 31, 2019, 4:54 a.m.