I have a data set with number of weeks from the beginning of the year (%W
), which I would like to convert to dates in order to plot it using date on x-axis
dat <- structure(data.frame(week = c(22, 34, 15), year = c(2009, 2009, 2010), x = c(3.4, 5.2, 1.3)))
I try to convert the weeks based on earlier questions here, but end up getting "YYYY-10-01"
for each date.
as.Date(paste("01", dat$week, dat$year, sep = "-"), format = "%d-%W-%Y")
Why is this and how can do it right?