R/tidyDate.R

Defines functions tidyDate

Documented in tidyDate

#' time series signiture
#'
#' @description This function adds time specific arguments to your dataframe
#' @param df The name of the dataframe you want to obtain time series information from, col defines the date vector from which the time series signiture is obtained
#' @param df The name of the dataframe you want to obtain time series information from, col defines the date vector
#' @return datatframe, tibble
#' @keywords time series arguments
#' @import dplyr, lubridate, rlang
#' @export
#' @examples tidyDate(df = df, var = statusvondatum)

tidyDate <- function(df, var = statusvondatum) {
  
  df <- df %>% 
    dplyr:::mutate(jahr = lubridate::year({{var}}),
                   quartal = lubridate::quarter({{var}}),
                   monat = lubridate::month({{var}}),
                   kalenderwoche = lubridate::week({{var}}),
                   tag = lubridate::day({{var}}),
                   wochentag = lubridate::wday({{var}}, abbr = TRUE, label = TRUE)) 
  
  return(df)
}
europace-privatkredit/tidyPkuData documentation built on Oct. 2, 2019, 3 a.m.