fread doesn't load properly POSIXct field created by fwrite with yaml = TRUE

Open
#3,999 2 comments 3 reactions 1 assignee View on GitHub

@MichaelChirico is already working on this.

Since Oct 27, 2019.

Assessment

This issue has not been assessed yet.

Description

fread

There's an unexpected behavior regarding POSIXct class with fread and fwrite when yaml = TRUE:

dt = data.table(date = as.POSIXct(c("2006-05-01", "2006-05-02")), 
                 b = as.factor(c(1,2)), 
                 c = c(3,4))
print(class(dt$date))
fwrite(dt, "dt.csv", yaml = TRUE)

dt2 = fread("dt.csv", yaml = TRUE)
print(class(dt2$date))

See: https://stackoverflow.com/questions/58493926/fread-with-yaml-true-read-type-date-as-character

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.