Skip to content

Fread bug in reading file with quotes #4221

Closed

Description

@arunsrinivasan
require(data.table) # today's devel
(dt <- data.table(my_col = Sys.time()))
#                 my_col
# 1: 2020-01-31 19:43:48
fwrite(dt, file=tmp<-tempfile(), quote=TRUE, dateTimeAs="write.csv")
readLines(tmp)
# [1] "\"my_col\""              "\"2020-01-31 19:43:48\""
fread(tmp)
#             V1  "my_col"
# 1: "2020-01-31 19:43:48"
# Warning messages:
# 1: In fread("~/Downloads/tmp.csv") :
#   Found and resolved improper quoting in first 100 rows. If the fields are not quoted (e.g. field separator does not appear within any field), try quote="" to avoid this warning.
# 2: In fread("~/Downloads/tmp.csv") :
#   Detected 1 column names but the data has 2 columns (i.e. invalid file). Added 1 extra default column name for the first column which is guessed to be row names or an index. Use setnames() afterwards if this guess is not correct, or fix the file write command that created the file to create a valid file.

Activity

  1. MichaelChirico commented on Jan 31, 2020

    @MichaelChirico
    Member

    related: #3509

  2. MichaelChirico commented on Nov 9, 2026

    @MichaelChirico
    Member

    Closed by #7370

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions