How to get week numbers from dates?
问题 Looking for a function in R to convert dates into week numbers (of year) I went for week from package data.table . However, I observed some strange behaviour: > week("2014-03-16") # Sun, expecting 11 [1] 11 > week("2014-03-17") # Mon, expecting 12 [1] 11 > week("2014-03-18") # Tue, expecting 12 [1] 12 Why is the week number switching to 12 on tuesday, instead of monday? What am I missing? (Timezone should be irrelevant as there are just dates?!) Other suggestions for (base) R functions are