View source: R/safe_month_min.R
safe_month_min | R Documentation |
Safely goes back N months for monthly data. This is an improved version of using filter(date >= last(date) library(tidyverse);library(lubridate) df <- data.frame(date = rmsfuns::dateconverter(StartDate = lubridate::ymd(20200831), EndDate = lubridate::ymd(20210228), Transform = 'calendarEOM')) df Note that this gives 7 months, not 6. Instead, use: df
safe_month_min(datesel, N = 6)
Ra |
N months back |
N months back
library(tidyverse);library(lubridate)
df <- data.frame(date = rmsfuns::dateconverter(StartDate = lubridate::ymd(20200131), EndDate = lubridate::ymd(20210228), Transform = 'calendarEOM'))
df %>% filter(date >= safe_month_min(last(date), N = 6))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.