`fwrite(dateTimeAs = "write.csv")` is not aligned with `write.csv()`
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 45/100
Direzione di ricerca
Start by reproducing the minimal example with fwrite(dateTimeAs = "write.csv"), write.csv(), and options("digits.secs"). Then locate the existing fwrite dateTimeAs coverage and determine how timestamp precision is selected; done means fwrite preserves the millisecond portion by default in the same way as write.csv, with regression coverage.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I just tried to replace some write.csv calls with fwrite using its dateTimeAs = "write.csv" option and noticed that by default (without setting digits.secs) fwrite removes the millisecond portion from the timestamps, which is not (or no longer) the case when using write.csv.
The background was discussed here. However, it seems only a corresponding test was adapted and fwrite was not aligned with write.csv.
Is this intentional? I think it's confusing.
Minimal reproducible example
library(data.table)
options("digits.secs")
# options(digits.secs = 3L)
DT <- data.table(TS = as.POSIXct("2026-02-26 13:21:49.123"))
write.csv(DT, file = "write.csv", quote = FALSE, row.names = FALSE)
readLines("write.csv")
# [1] "TS" "2026-02-26 13:21:49.123"
fwrite(DT, file = "fwrite.csv", dateTimeAs = "write.csv")
readLines("fwrite.csv")
# [1] "TS" "2026-02-26 13:21:49"
sessionInfo()
R version 4.5.2 (2025-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 10 x64 (build 19045)
Matrix products: default
LAPACK version 3.12.1
locale:
[1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8
[3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8
time zone: Europe/Berlin
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] data.table_1.18.2.1
loaded via a namespace (and not attached):
[1] compiler_4.5.2 cli_3.6.5 tools_4.5.2 rstudioapi_0.18.0 pkgload_1.5.0
[6] rlang_1.1.7
- Lingua principale
- R
- Stelle
- 3.9k
- Fork
- 1.1k
- Merge medio
- 15h 51m
- PR unite (30g)
- 3
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Rdatatable/data.table
-
as.data.table() recurses without end on a survival::Surv object (or any data.frame carrying one)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
Rdatatable/data.table#7887 ·
-
test() doesn't distinguish plain NA_real_, NaNForse già presa @MichaelChirico l’ha presa 68 giorni fa. Apertaconsistency tests
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Rdatatable/data.table#7853 · 3 commenti ·
-
HAVE_LONG_DOUBLE is conditioned on but never setForse già presa @venom1204 l’ha presa 512 giorni fa. Apertainternals
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
Rdatatable/data.table#6938 · 1 commento ·
-
encoding fread
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
Rdatatable/data.table#5179 · 8 commenti ·
-
documentation programming
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Rdatatable/data.table#3199 · 3 commenti ·
Tutte le issue di Rdatatable/data.table
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
datacarpentry/semester-biology#1272 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
pkgdown build failureAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
hubverse-org/hubUtils#317 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno