It's not difficult to do that (some ways that I know of below). Just being curious if there is already a function out there that generates such a sequence very easily, ideally with a rather common package or even base R.
## just for printing purpose
headtail <- function(x){
cat(as.character(head(x, 3)), "...", as.character(tail(x, 3)))
}
## is ok, but lots of typing
x <- seq(as.Date("2021-01-01"), as.Date("2021-12-31"), by = "day")
headtail(x)
#> 2021-01-01 2021-01-02 2021-01-03 ... 2021-12-29 2021-12-30 2021-12-31
## shorter, but requires a priori knowledge of length of this year
x <- seq(as.Date("2021-01-01"), length = 365, by = "day")
headtail(x)
#> 2021-01-01 2021-01-02 2021-01-03 ... 2021-12-29 2021-12-30 2021-12-31
## or
x <- as.Date(0:364, origin = "2021-01-01")
headtail(x)
#> 2021-01-01 2021-01-02 2021-01-03 ... 2021-12-29 2021-12-30 2021-12-31
## I can of course make my own function
ydays <- function(year){
seq(as.Date(paste0(as.character(year), "-01-01")), as.Date(paste0(as.character(year), "-12-31")), by = "day")
}
x <- ydays(2021)
headtail(x)
#> 2021-01-01 2021-01-02 2021-01-03 ... 2021-12-29 2021-12-30 2021-12-31