Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

replace_date

Replace Dates With Words


Description

Replaces dates with word equivalents.

Usage

replace_date(x, pattern = NULL, replacement = NULL, ...)

Arguments

x

The text variable.

pattern

Character date regex string to be matched in the given character vector.

replacement

A function to operate on the extracted matches or a character string which is a replacement for the matched pattern.

...

ignored.

Value

Returns a vector with the pattern replaced.

Examples

x <- c(
    NA, '11-16-1980 and 11/16/1980', 
    "and 2017-02-08 but then there's 2/8/2017 too"
)

replace_date(x)
replace_date(x, replacement = '<<DATE>>')

textclean

Text Cleaning Tools

v0.9.3
GPL-2
Authors
Tyler Rinker [aut, cre], ctwheels StackOverflow [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.