date | R Documentation |
Date based cleaning
date_standardize(x, format = "%Y-%m-%d", date_column = "date", ...) date_missing(x, date_column = "date", drop = TRUE, ...) date_create(x, ...) date_create_(x, ..., .dots, format = "%Y-%m-%d", date_column = "date")
x |
(data.frame) A data.frame |
format |
(character) Date format. See |
date_column |
(character) Name of the date column |
... |
Comma separated list of unquoted variable names |
drop |
(logical) Drop bad data points or not. Either way, we parse
out bade data points as an attribute you can access. Default: |
.dots |
Used to work around non-standard evaluation |
date_standardize - Converts dates to a specific format
date_missing - Drops records that do not have dates, either via being NA or being a zero length character string
date_create - Create a date field from
Returns a data.frame, with attributes
df <- sample_data_1 # Standardize dates dframe(df) %>% date_standardize() dframe(df) %>% date_standardize("%Y/%m/%d") dframe(df) %>% date_standardize("%d%b%Y") dframe(df) %>% date_standardize("%Y") dframe(df) %>% date_standardize("%y") # drop records without dates NROW(df) NROW(dframe(df) %>% date_missing()) # Create date field from other fields df <- sample_data_2 ## NSE dframe(df) %>% date_create(year, month, day) ## SE date_create_(dframe(df), "year", "month", "day")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.