View source: R/lazyDateCoding.R
lazyDateCoding | R Documentation |
This function eases the process of generating date variables. All variables in a data.frame which match a regular expression are included
lazyDateCoding(data, format, pattern, varnames, testlength = 10)
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. |
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.
R-code one line for each variable.
Thomas Alexander Gerds
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.