formatDate

0th

Percentile

Function to transform dates into "Date" R format

Given a data.frame object with a column of dates in 'character' format, it generates a new data.frame object with the dates transformed into "Date" R format.

Usage
formatDate(input, dateColumn, dateFormat = "%y/%m/%d",
  verbose = FALSE)
Arguments
input

A data.frame object with at least one column of dates.

dateColumn

The name of the column containing the date.

dateFormat

By default '%y/%m/%d'. Change it to the specific structure of your date format.

verbose

By default FALSE. Change it to TRUE to get an on-time log from the function.

Value

An object of class data.frame with the date column transform into 'Date' R class.

Aliases
  • formatDate
Examples
# NOT RUN {
dataset <- read.csv2(system.file("extdata",
                                   "nhdsSubset.csv",
                                   package="EHRtemporalVariability"), 
                     sep  = ",",
                     header = TRUE, 
                     na.strings = "", 
                     colClasses = c( "character", "numeric", "factor",
                                     "numeric" , rep( "factor", 22 ) ) )
                     
datasetFormatted <- formatDate( 
              input         = dataset, 
              dateColumn    = "date", 
              dateFormat    = "%y/%m",
             )
# }
Documentation reproduced from package EHRtemporalVariability, version 1.0, License: Apache License 2.0 | file LICENSE

Community examples

Looks like there are no examples yet.