R/tidyEuropaceCent.R

Defines functions tidyEuropaceCent

#' Europace-Cent
#'
#' @description This function calculates the Europace-Cent
#' @param df The name of the dataframe you want to manipulate
#' @return datatframe, tibble
#' @keywords Europace-Centnts
#' @import dplyr
#' @export
#' @examples tidyEuropaceCent(df = df)

tidyEuropaceCent <- function(df) {

  df <- df %>%
    dplyr::mutate(rsv_europace_nutzungsgebuehr = dplyr::if_else(is.na(rsv_europace_nutzungsgebuehr), 0, rsv_europace_nutzungsgebuehr),
                  europace_nutzungsgebuehr = dplyr::if_else(is.na(europace_nutzungsgebuehr), 0, europace_nutzungsgebuehr),
                  europace_nutzungsgebuehr = dplyr::if_else((produktanbieterid == 'VEB' & produktbezeichnung == 'Ratenkredit (manuelle Entscheidung)'),
                                                            0, europace_nutzungsgebuehr),
                  europace_nutzungsgebuehr = round(dplyr::if_else((produktanbieterid == 'VEB' & effektivzins == 9.95), (0.00002*laufzeit*auszahlungsbetrag),
                                                                  europace_nutzungsgebuehr), digits = 2),
                  europace_nutzungsgebuehr_gesamt = europace_nutzungsgebuehr + rsv_europace_nutzungsgebuehr)

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