generate_dates: Generate Dates

View source: R/generate_dates.R

generate_datesR Documentation

Generate Dates

Description

This function generates a sequence of dates based on the specified start and end dates, and filters the dates to include only the selected days of the week.

Usage

generate_dates(start_date, end_date, days_of_week, locale = "us")

Arguments

start_date

The start date of the date sequence in "YYYY-MM-DD" format.

end_date

The end date of the date sequence in "YYYY-MM-DD" format.

days_of_week

A string specifying the days of the week to include in the date sequence. Each character represents a day of the week (e.g., "m" for Monday, "t" for Tuesday).

locale

The locale to use for determining the day names. Default is "us" (United States). If set to "es" (Spanish), the dates will take European format (DD-MM-YYYY) and the day names will be translated to Spanish.

Value

A data frame with two columns: 'date' (formatted dates) and 'day' (day names).

Examples

## Not run: 
generate_dates("2024-01-17", "2024-05-01", "wf", locale = "es")

## End(Not run)

francojc/francojcr documentation built on Feb. 1, 2024, 9:56 p.m.