Skip to content

Just use base functionality for isoweek? #5111

@MichaelChirico

Description

@MichaelChirico

Happened to notice that format((Date), "%V") gives identical results to our isoweek, and it's a decent amount faster. Should we just migrate our backend to use base?

e.g.

x = rep(Sys.Date() - 0:5000, 1000)

system.time(out1 <- isoweek(x))
#    user  system elapsed 
# 12.428  21.093  34.376 
system.time(out2 <- as.integer(format(x, '%V')))
#    user  system elapsed 
#   4.346   0.221   4.685 

identical(out1, out2)
# [1] TRUE

Or should we try and optimize it better?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions