#' brokerage firm factor levels
#'
#' @description This function recodes factor levels in brokerage firm vector
#' @param df The name of the dataframe you want to manipulate
#' @return datatframe, tibble
#' @keywords brokerage firm levels
#' @import dplyr, stringr
#' @export
#' @examples tidyVo(df = df)
tidyVo <- function(df) {
testVo <- c('COMMERZBANK_RK_TESTACCOUNTS',
'DKB',
'FINMAS_TESTVERTRIEB',
'VON_ESSEN_BANK',
'HYPOPORT',
'TEST_HYPOPORT',
'HYPO1',
'HYPOPORT22',
'MUSTERBANK',
'MUSTERVERTRIEB',
'OYAK_ANKER_BANK',
'SONSTIGE',
'OID',
'SKG',
'CHECK24',
'HIHI',
'TEST',
'TEST_EIGENSONNE',
'TEST_HYPOPORT',
'SUPERORGA',
"")
df <- df %>%
dplyr::filter(!vertriebsorganisationsid %in% testVo) %>%
dplyr::mutate(vertriebsorganisationsid = dplyr::case_when(
stringr::str_detect(vertriebsorganisationsid, pattern = 'AUXMONEY') ~ 'AUXMONEY',
stringr::str_detect(vertriebsorganisationsid, pattern = 'DR_KLEIN_') | vertriebsorganisationsid == 'OKO48' ~ 'RK_GMBH',
stringr::str_detect(vertriebsorganisationsid, pattern = 'FINANZIERUNGSPOOL') | stringr::str_detect(vertriebsorganisationsid, pattern = 'BAUFINANZ_TEAM') ~ 'DSL_STAR',
stringr::str_detect(vertriebsorganisationsid, pattern = 'DT_RING') ~ 'DT_RING',
stringr::str_detect(vertriebsorganisationsid, pattern = 'DSL') ~ 'DSL_STAR',
stringr::str_detect(vertriebsorganisationsid, pattern = 'SPK') | str_detect(vertriebsorganisationsid, pattern = 'LBS_OST') | str_detect(vertriebsorganisationsid, pattern = 'KSK') ~ 'FINMAS',
stringr::str_detect(vertriebsorganisationsid, pattern = 'FONDS') ~ 'FONDSFINANZ',
stringr::str_detect(vertriebsorganisationsid, pattern = 'STARPOOL_') | stringr::str_detect(vertriebsorganisationsid, pattern = 'POSTBANK_') ~ 'PB_VERTRIEB',
stringr::str_detect(vertriebsorganisationsid, pattern = 'PLANET') ~ 'PLANETHOME',
stringr::str_detect(vertriebsorganisationsid, pattern = 'PSD') ~ 'PSD',
stringr::str_detect(vertriebsorganisationsid, pattern = 'QUALITYPOOL') ~ 'QUALITYPOOL',
stringr::str_detect(vertriebsorganisationsid, pattern = 'BAUFINEX') ~ 'BAUFINEX',
TRUE ~ vertriebsorganisationsid)) %>%
dplyr::filter(vertriebsorganisationsid != 'TEST')
return(df)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.