2
I need to generate a calendar with working days in R, but only for the current year. I am using the package bizdays
to generate the days, but do not know a way to select only the current year.
I tried to use it this way, but it didn’t work:
library(bizdays)
library(lubridate)
date <- as.Date("2020-01-01")
data <- seq(as.Date(date), length = 2, by = "+12 months")[2]
dias_uteis <- bizseq(from = date, to = data, cal = "Brazil/ANBIMA")
dias_uteis <- subset(dias_uteis, dias_uteis %in% year(date))
I don’t understand why the command
dias_uteis <- bizseq(from = date, to = data, cal = "Brazil/ANBIMA")
no longer solves this problem. For me, a sequence of 251 dates was created (see the result oflength(dias_uteis)
) which does not have several days, as can be seen in the result oftail(dias_uteis)
:"2020-12-23" "2020-12-24" "2020-12-28" "2020-12-29" "2020-12-30" "2020-12-31"
.– Marcus Nunes