View source: R/get_date_from_text.R
get_date_from_text | R Documentation |
This function extracts dates from text using specified patterns and formats.
get_date_from_text(texts, cb, type, links)
texts |
A tibble containing the text from which dates will be extracted. The tibble must have a column named "text" containing the text data. |
cb |
A character string indicating the source or context of the text (e.g., "boj", "fed"). |
type |
A character string indicating the type of text (e.g., "minutes", "teala"). |
links |
A character vector containing the links associated with the text. |
The function searches for specific date patterns in the provided text using regular expressions. It handles different formats and variations of dates commonly found in texts, such as "1st January 2022", "Jan 1, 2022", "01/01/22", etc. The extracted dates are then returned as start dates, end dates, and release dates, depending on the context and type of text.
A list with three elements:
start_date |
A vector of start dates extracted from the text. |
end_date |
A vector of end dates extracted from the text. |
release_date |
A vector of release dates extracted from the text. |
## Not run:
texts <- tibble::tibble(text = c("The minutes of the meeting held on January 15, 2022 are available now.",
"Please refer to the report published on 01/20/22 for more information."))
cb <- "boj"
type <- "minutes"
links <- c("https://www.example.com/minutes_2022.html", "https://www.example.com/report_2022.html")
get_date_from_text(texts, cb, type, links)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.