Skip to content

week() function returns a 6 day week at the beginning of a year #251

Closed
@CameronBieganek

Description

@CameronBieganek

There is a bug in the week() function which leads to the first week of the year being only 6 days long. For example, if you type

x <- seq(from = ymd("2014-01-01"), to = ymd("2014-01-10"), by = "days")
week(x)

then you'll get 1 1 1 1 1 1 2 2 2 2. The code should be changed from it's current state, which is this:

function(x)
yday(x) %/% 7 + 1

to this:

function(x)
(yday(x) - 1) %/% 7 + 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions