Description Usage Arguments Details Value Note Author(s)
Return a vector of possible dates of a years, or dates of a month in a year.
1 | year_month(df, select_year, select_month = NULL, previous = FALSE)
|
df |
dataset to obtain the dates |
select_year |
year that we want to obtain the vector |
select_month |
name of the month of the year that we want to obtain the vector |
previous |
If we want to obtain the previous year or month |
This function allows you to return a vector of dates from a year (or the previous one) OR dates of a month of a year (or the previous month)
"This function returns different results based on the arguments select_year, select_month & previous".
If previous = FALSE and select_year return a vector of dates of that year in the date variable.
If previous = TRUE and select_year return a vector of dates of the previous year in the date variable.
If previous = FALSE and select_month return a vector of dates of that month of the year select_year in the date variable.
If previous = TRUE and select_month return a vector of dates of the previous month year select_year in the date variable.
If the df does not have a date variable, then return a string message.
If the selected select_year is not included in the observations of the date variable from df then return a string message.
If previous = TRUE & select_month = "JANUARY" then will return a string message, since it returns the observations of the previous of the exact year select_year ( not the previous one ).
If previous = TRUE and there is no previous select_year or select_month, then will return a string message.
Eduardo Trujillo
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.