Skip to content

fread warning on "stopped reading" should interact with nrows #1671

@MichaelChirico

Description

@MichaelChirico

I'm reading a file that has some sort of metadata printed below the main data; fread smartly skips reading this but produces a warning:

Warning message:
In fread(...) :
Stopped reading at empty line 201268 but text exists afterwards (discarded): (201266 row(s) affected)

Trying to minimize the warnings my code produces, I tried to manually set nrows so that fread ends before finding this little oddity, but I get the same warning.

Reproducible version:

fread("col1, col2, col3
1, 2, 3
3, 5, 6
7, 8, 9

some text to ignore", nrows = 4L)

Outputs:

#    col1 col2 col3
#1:    1    2    3
#2:    3    5    6
#3:    7    8    9

Warning message:
In fread("col1, col2, col3\n1, 2, 3\n3, 5, 6\n7, 8, 9\n\nsome text to ignore", :
Stopped reading at empty line 5 but text exists afterwards (discarded): some text to ignore

The warning is surprising since we told fread to read 4 rows and it's still worried about things happening in rows 5 and beyond.

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