I've been having some struggles with dates. Namely, being able recognize a variable (as a Date
variable) that has dates registered by the following manner: Year-ISO week. So the following code:
class("2021-20")
Idealy should return: Date
.
The following code recognizes it as a date
, but it returns a date that I don't understand where it comes from. And even if I try with other dates (different values of the ISO week), I always get the same response:
as.Date("2021-20", format = "%Y-%W")
[1] "2021-12-13"
I've tried transforming "normal dates" to the format year-iso week, but it leads to no where, I can never get it to be recognized as a Date
object, and I need to perform ggplot2
graphs.