get_date_range: Get minimum and maximum date for a vector of dates

View source: R/get_date_range.R

get_date_rangeR Documentation

Get minimum and maximum date for a vector of dates

Description

This function will attempt to auto-detect the date format using lubridate, then determine the minimum and maximum for the submitted vector of dates. It is intended as a helper function for selecting date ranges and adding them to queries.

Usage

get_date_range(dates)

Arguments

dates

character vector of dates to extract the date range from

Value

Returns a list object with two values (minimum and maximum date)

Author(s)

Amy Mikhail, amy.mikhail@gmail.com

Examples

# Create a character vector of dates:
x <- c("2022-07-15", "2021-08-09", NA, "2022-08-03")

# Get date range:
daterange <- get_date_range(dates = x)

# View the result:
daterange

WorldHealthOrganization/godataR documentation built on May 21, 2023, 11:30 a.m.