colToDate: Convert a Character Time Column into a Date and Strip Out...

View source: R/colToDate.R

colToDateR Documentation

Convert a Character Time Column into a Date and Strip Out Hour and Day

Description

This function converts a character column in a data frame to time and then strips out day and hour of the time as new columns. The output is a new data frame with one modified column (character converted to date) and two new columns (day of week and hour of day).

Usage

colToDate(dat, dateColName, dateFormat)

Arguments

dat

This is the data source to be converted

dateColName

This is the name of the date column to be converted

dateFormat

This is the format of the date column

Examples

testDat <- data.frame(stringsAsFactors = FALSE, time = c("2016-10-31","2016-12-25","2016-07-04"),event = c("Halloween","Christmas","US Independence Day"))
testDat <- colToDate(testDat,"time","%Y-%m-%d")

jsdeherrera/shinyBoots documentation built on March 9, 2024, 3:03 a.m.