R/tidyFrontend.R

Defines functions tidyFrontend

#' frontend factor levels
#'
#' @description This function recodes factor levels in frontend vector
#' @param df The name of the dataframe you want to manipulate
#' @return datatframe, tibble
#' @keywords frontend levels
#' @import dplyr, forcats
#' @export
#' @examples tidyFrontend(df = df)

tidyFrontend <- function(df) {

  df <- df %>%
    dplyr::mutate(frontend = as.factor(frontend),
           frontend = forcats::fct_recode(frontend,
                                 'OMC' = 'EUROPACE Classic',
                                 'KS'  = 'EUROPACE 2')
    )

  return(df)
}
europace-privatkredit/tidyPkuData documentation built on Oct. 2, 2019, 3 a.m.