rweekly / rweekly.org

R Weekly

Home Page:https://rweekly.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Proposal: R Weekly to use '2020W46' instead of '2020-46'

HenrikBengtsson opened this issue · comments

As a stickler for ISO standards, I noticed that R Weekly indexes its weekly updated as "2020-46". I think it would be cool if R Weekly would take the opportunity to promote the ISO week date system part of the ISO 8601 date format (that is mostly known for YYYY-MM-DD) to the R community. That is, instead of writing:

R Weekly 2020-46 ...

you could write:

R Weekly 2020W46 ...

to indicate that the post covers week 46 of 2020. This format is also recognized by many in the industry - at least in Europe.

The only thing that might differ is that the post that will come out on Sunday 2021-01-03 (= 2020W53.7) covering the week 2020-12-28/2021-01-03 should then be labeled '2020W53' and not '2021-01' because the first week of 2021 starts on 2021-01-04.

<end of procrastination>

EDIT: fixed incorrect year labels are the new year - switching to a new year is still not my thing

A friendly bump before it's "too late" - if someone agrees with the above, next release should really be '2020W53'

commented

Thanks, I think we can start the pattern from the future release and keep the past posts url and title the same as before.

So the next issue will be 2020-W53 ?

Woohoo. Yes, we're currently on week 2020-W53 which runs from Monday 2020-12-28 to Sunday 2021-01-03. The week after this week will be 2021-W01 running from Monday 2021-01-04 to Sunday 2021-01-10.

From ?format.POSIXct:

%G
    The week-based year (see %V) as a decimal number. (Accepted but ignored on input.)

%V
    Week of the year as decimal number (01–53) as defined in ISO 8601. If the week (starting on Monday) 
    containing 1 January has four or more days in the new year, then it is considered week 1. Otherwise,
    it is the last week of the previous year, and the next week is week 1. (Accepted but ignored on input.)

So, you can produce these using format(date, "%G-W%V"). For example,

> dates <- seq(from=as.Date("2020-12-13"), to=as.Date("2021-01-31"), by=7L)
> data.frame(weekday=format(dates, "%A"), date=dates, week=format(dates, "%G-W%V"))
  weekday       date     week
1  Sunday 2020-12-13 2020-W50
2  Sunday 2020-12-20 2020-W51
3  Sunday 2020-12-27 2020-W52
4  Sunday 2021-01-03 2020-W53
5  Sunday 2021-01-10 2021-W01
6  Sunday 2021-01-17 2021-W02
7  Sunday 2021-01-24 2021-W03
8  Sunday 2021-01-31 2021-W04
commented

I think the next issue shoule be 2021-W01, because the release date is 2021-01-04.

It is in the first week of 2021 and it is the first issue of 2021.

Ah... so you're releasing on Mondays - from my time zone I always thought it was on Sundays.

Regardless, before you've indexed your releases. If one instead put a timestamp on it as I propose here, it comes down to what you want that timestamp to represent. As I see it, it can either represent:

  1. the week it was released, or
  2. the week that the content was collected, i.e. the 7 days prior to the release.

If you released on Sundays, they would both be the same and it would be an easy decision. The way I thought about it was that it should reflect the week that the post covers (Alt. 2).