unexpected round.IDate(x, 'week') behavior

Open
#2,083 4 comments 0 reactions 1 assignee View on GitHub

@MichaelChirico is already working on this.

Since Sep 2, 2019.

Assessment

This issue has not been assessed yet.

Description

feature request IDate/ITime

I would expect round.IDate(x, 'week') to round to the nearest beginning of the week, either Monday or Sunday. And yet:

> library(data.table)
data.table 1.10.4
  The fastest way to learn (by data.table authors): https://www.datacamp.com/courses/    data-analysis-the-data-table-way
  Documentation: ?data.table, example(data.table) and browseVignettes("data.table")
  Release notes, videos and slides: http://r-datatable.com
> round(as.IDate('2017-04-01'), 'week') # Saturday
[1] "2017-04-02"
> round(as.IDate('2017-03-31'), 'week') # Friday
[1] "2017-03-26"

That is, Saturday gets rounded up by one day while Friday gets rounded down by five days?

Dominant language
R
Stars
3.9k
Forks
1.1k
Avg merge
14h 4m
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Rdatatable/data.table

All issues in Rdatatable/data.table

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.