Learn R Programming

stlcsb (version 0.1.2)

csb_date_parse: Parse CSB Date and Time Variables

Description

csb_date_parse is used to parse out dates into day, month, and year elements.

Usage

csb_date_parse(.data, var, day, month, year, drop = FALSE)

Arguments

.data

A tibble or data frame

var

name of column containing date data

day

Optional; returns a named column with parsed day

month

Optional; returns a named column with parsed month

year

Optional; returns a named column with parsed year

drop

A logical scalar; if TRUE, removes the original column that had contained date and time data, otherwise if FALSE the original column is retained.

Value

Returns a tibble with new columns containing parsed date information

Examples

Run this code
# NOT RUN {
csb_date_parse(january_2018, datetimeinit, dayInit)
csb_date_parse(january_2018, datetimeinit, dayInit, monthInit)
csb_date_parse(january_2018, datetimeinit, month = monthInit)
csb_date_parse(january_2018, datetimeinit, month = monthInit, year = yearInit)
csb_date_parse(january_2018, datetimeinit, dayInit, monthInit, yearInit, drop = TRUE)

# }

Run the code above in your browser using DataLab