#' product
#'
#' @description This function obtains the product category from product names
#' @param df The name of the dataframe you want to manipulate
#' @return datatframe, tibble
#' @keywords product category
#' @import dplyr, stringr
#' @export
#' @examples tidyProduct(df = df)
tidyProduct <- function(df) {
df <- df %>%
dplyr::mutate(produktart = dplyr::case_when(
stringr::str_detect(produktbezeichnung, pattern = 'Auto') ~ 'Autokredit',
stringr::str_detect(produktbezeichnung, pattern = 'DSL Business Kredit') ~ 'Businesskredit',
stringr::str_detect(produktbezeichnung, pattern = 'SofortKredit') ~ 'Sofortredit',
stringr::str_detect(produktbezeichnung, pattern = 'Modernisierungskredit') |
stringr::str_detect(produktbezeichnung, pattern = 'WohnKredit') |
stringr::str_detect(produktbezeichnung, pattern = 'Modernisierung') |
stringr::str_detect(produktbezeichnung, pattern = 'Immo') |
stringr::str_detect(produktbezeichnung, pattern = 'Wohn') ~ 'Wohnkredit',
TRUE ~ 'Ratenkredit')
)
return(df)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.