Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

`fwrite(dateTimeAs = "write.csv")` is not aligned with `write.csv()`

Abierto
#7,653 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
r
Área
data

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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  
Lenguaje dominante
R
Estrellas
3.9k
Forks
1.1k
Merge medio
15 h 51 min
PR fusionados (30 d)
3

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Rdatatable/data.table

Todos los issues de Rdatatable/data.table

Issues similares

Más issues de R

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.