Maria Ma

I struggled a bit with this, so I figured I’d leave this here.

Dividing the day of the month by 7 and rounding up would work… if the week started on a Sunday (or whatever day you choose to start the week with).

To account for the shift in days, shift ‘back’ by subtracting the day of week from the day.

--

--

I’m pretty mad I had to deal with this, so I’m writing this to save you, the R user who has to deal with a database that contains both Devanagari numbers and Arabic numbers, some effort for this extremely niche use case.

Requires tidyverse, and you’re probably still going to have to re-cast your column types (eg, dates).

--

--

Maria Ma

Maria Ma

A public health nerd. I make graphs in R.