lazyDateCoding: Efficient coding of date variables

Description Usage Arguments Details Value Author(s) Examples

View source: R/lazyDateCoding.R

Description

This function eases the process of generating date variables. All variables in a data.frame which match a regular expression are included

Usage

1
lazyDateCoding(data, format, pattern, varnames, testlength = 10)

Arguments

data

Data frame in which to search for date variables.

format

passed to as.Date

pattern

match date variables

varnames

variable names

testlength

how many rows of data should be evaluated to guess the format.

Details

The code needs to be copy-and-pasted from the R-output buffer into the R-code buffer. This can be customized for the really efficiently working people, e.g., in emacs.

Value

R-code one line for each variable.

Author(s)

Thomas Alexander Gerds

Examples

1
2
3
d <- data.frame(x0="190101",x1=c("12/8/2019"),x2="12-8-2019",x3="20190812",stringsAsFactors=FALSE)
lazyDateCoding(d,pattern="x")
lazyDateCoding(d,pattern="3")

Publish documentation built on Jan. 8, 2021, 5:37 p.m.