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/surveydolphinr documentation built on May 27, 2020, 12:06 a.m.