nth_weekday_of_a_month: Function to find the nth weekday in a certain month

Description Usage Arguments Value Examples

View source: R/nth_weekday_of_a_month.R

Description

Function to find the nth weekday in a certain month

Usage

1
nth_weekday_of_a_month(dates, nth, weekday, month)

Arguments

dates

A vector with dates in the format YYYY-MM-DD

nth

int. The nth weekend you want to search for given a day and month

weekday

int. Sunday counts as 1, monday as 2, etc.

month

int. The month of interest (1 for January, 2 for February etc.)

Value

Date written in type character.

Examples

1
2
3
4
dates <- seq_days(from = "2021-1-1", to = "2021-12-31")
# Suppose you want to find the date of mother's day
# Mother's day falls on the second sunday of may, thus:
nth_weekday_of_a_month(dates, nth = 2, weekday = 1, month = 5)

Glender/DutchDayDummies documentation built on Feb. 24, 2022, 7:15 a.m.