dates <- NULL
date <- as.Date("01/01/2014","%d/%m/%Y")
dates <- data.frame(date=as.Date(character())
                    ,cal_day_in_year_num = numeric()
                    ,cal_week_id = numeric()
                    ,cal_week_start_date = as.Date(character())
                    ,cal_week_end_date = as.Date(character())
)
for (i in 1:365) {
  dates[i,1] <- date + days(i-1) ## date
  dates[i,2] <- yday(dates[i,1]) ## cal_day_in_year_num
  dates[i,3] <- paste(year(dates[i,1]),sprintf("%02d",week(dates[i,1])),sep="") ## cal_week_id
  dates[i,4] <- floor_date(dates[i,1], "week") ## cal_week_start_date
  dates[i,5] <- ceiling_date(dates[i,1], "week") ## cal_week_end_date
}
View(dates)
For given dates I'm trying to use the lubridate function to calculate the corresponding start and end dates of the week
The issue I'm having is that lubridate is taking the first day of the week to be Sunday, where as I need it to be Monday - does anyone have a way round this?