Home > Back-end >  Adding a Date column that corresponds to the value in the day of the week column in R
Adding a Date column that corresponds to the value in the day of the week column in R

Time:04-24

How do I add a Date column that corresponds to the value in the day of the week column in R?

For example, if the WeekStarting value is “2016-01-03”, then the value in the Date column for the Monday that comes after “2016-01-03” should have a value of “2016-01-04”.

https://i.stack.imgur.com/YErsJ.png

CodePudding user response:

Try first just adding a column that has the consecutive dates

seq(as.Date("2016/1/3"), as.Date("2016/1/17"), "days")
  •  Tags:  
  • r
  • Related