Skip to content

read_table() can wrongly read numbers (silently) #518

@aphalo

Description

@aphalo

read_table() miss reads numbers in the first column when there is white space at the start of enough lines at the top of the file.

Of the attached files the shorter readr-read-table.txt is correctly read, but the second and longer file readr-read-table-2.txt is incorrectly read, with 1000 interpreted as 0, 1001 as 1, etc.

 readr::read_table("readr-read-table.txt", col_types = "dd")
 readr::read_table("readr-read-table-2.txt", col_types = "dd")

readr-read-table.txt
readr-read-table-2.txt

I noticed a problem with some of my files some months ago, but I did not find the cause of the problem until yesterday. utils::read.table() has no problems with either of these files.

readr installed from this repository minutes ago. 1.0.0.9000
R 3.3.1 Windows 10 x64.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancementread 📖

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions