find latest sunday date
Examples
exampleDataR= data.table::as.data.table(exampleDataR)
exampleDataR = exampleDataR[order(location,item,date)]
exampleDataR = exampleDataR[,date:= date_mdy_ymd(date)]
#> Error in date_mdy_ymd(date): could not find function "date_mdy_ymd"
exampleDataR[,week_start_date:= week_start(date)]
#> Error in charToDate(x): character string is not in a standard unambiguous format
head(exampleDataR,15)
#> location item date sales
#> 1: ankara tea 4/23/1920 22
#> 2: ankara tea 4/24/1920 30
#> 3: ankara tea 4/25/1920 29
#> 4: ankara tea 4/26/1920 34
#> 5: ankara tea 4/27/1920 9
#> 6: ankara tea 4/28/1920 15
#> 7: ankara tea 4/29/1920 40
#> 8: ankara tea 4/30/1920 7
#> 9: ankara tea 5/1/1920 26
#> 10: ankara tea 5/10/1920 39
#> 11: ankara tea 5/11/1920 39
#> 12: ankara tea 5/12/1920 12
#> 13: ankara tea 5/13/1920 2
#> 14: ankara tea 5/14/1920 29
#> 15: ankara tea 5/15/1920 7