Document as.IDate() behaviour with fractional dates
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 1/5
- 預估耗時
- 1 小時以內
- 新手友好度
- 78/100
- Issue 類型
- 文件
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- r
研究方向
此行為來自 as.IDate() 對 Date 輸入的處理,它會經過 as.integer(),因此朝 epoch 方向進位;報告中的範例顯示了先向下取整的差異。請找到 as.IDate 的文件(其 Rd 檔或 roxygen 區塊),並加入一段簡短說明:帶小數的 Date 值會朝零截斷,並附上 issue 中的範例。當說明頁面載明了捨入方式且範例仍能執行時,即視為完成。
由索引模型根據 Issue 內容生成。
描述
as.IDate() calls as.integer() on Date input which means fractional dates are rounded towards the unix epoch. This leads to the following behaviour.
(origin <- .Date(0))
#> [1] "1970-01-01"
(dates <- c(origin - 0.2, origin + 0.2))
#> [1] "1969-12-31" "1970-01-01"
data.table::as.IDate(dates)
#> [1] "1970-01-01" "1970-01-01"
# I believe this is being done internally with the 'Date' method
as.integer(dates)
#> [1] 0 0
# Alternative is to floor first
as.integer(floor(unclass(dates)))
#> [1] -1 0
To me flooring is the more 'expected' result so (assuming it is not something you wish to change) is it worth pointing this behaviour out explicitly in the documentation. Apologies if I've missed this but couldn't see it mentioned.
- 主要語言
- R
- 星號
- 3.9k
- 分支
- 1.1k
- 平均合併
- 1 天 8 小時
- 30 天內合併 PR
- 14
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
Rdatatable/data.table 的其他 Issue
-
beginner-task
難度 2/5 1-3 小時 新手友好度 68/100
Rdatatable/data.table#7948 · 2 則留言 ·
維護者通常 1 天內回覆
-
as.data.table() recurses without end on a survival::Surv object (or any data.frame carrying one)未關閉
難度 2/5 1-3 小時 新手友好度 88/100
Rdatatable/data.table#7887 ·
維護者通常 1 天內回覆
-
test() doesn't distinguish plain NA_real_, NaN可能已有人在做 @MichaelChirico 於 99 天前認領。 未關閉consistency tests
難度 2/5 1-3 小時 新手友好度 68/100
Rdatatable/data.table#7853 · 3 則留言 ·
維護者通常 1 天內回覆
-
HAVE_LONG_DOUBLE is conditioned on but never set可能已有人在做 @venom1204 於 543 天前認領。 未關閉internals
難度 2/5 1-3 小時 新手友好度 65/100
Rdatatable/data.table#6938 · 1 則留言 ·
維護者通常 1 天內回覆
-
encoding fread
難度 2/5 1-3 小時 新手友好度 65/100
Rdatatable/data.table#5179 · 8 則留言 ·
維護者通常 1 天內回覆
查看 Rdatatable/data.table 的全部 Issue
相似的 Issue
-
bug key bindings source editor
難度 2/5 1-3 小時 新手友好度 75/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
REQ - Positron IDE guidance可能已有人在做 @johannajokio 於 2 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 70/100
-
get_procs() @return docs don't match returned columns, and pid column is the row index可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 2/5 1-3 小時 新手友好度 67/100
posit-dev/connectapi#532 ·
-
難度 2/5 1-3 小時 新手友好度 67/100
Huber-group-EMBL/Rarr#302 ·
維護者通常 1 天內回覆