Skip to content

nrows=0 interferes with proper sep detection #2747

@st-pasha

Description

@st-pasha

(even if sep is given explicitly):

> fread("A,B,C\n1,2,3\n3,4,5\n0,0,0\n", nrows=0)
Empty data.table (0 rows) of 1 col: A,B,C
> fread("A,B,C\n1,2,3\n3,4,5\n0,0,100\n", nrows=0, sep=',')
Empty data.table (0 rows) of 1 col: A,B,C

Expected result: a 0 rows x 3 columns data.table with columns "A", "B", and "C"

Also, documentation says

nrows=0 returns the column names
and typed empty columns determined by the large sample;
useful for a dry run of a large file or to quickly check
format consistency of a set of files before starting to read
any of them.

As far as I understand, this is no longer accurate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions