fread suggests fill for dropped column

Open
#6,050 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
r
Domain
data

Research direction

Start by reproducing the two examples with fread, using drop=3 and colClasses=list(NULL=3). Inspect fread's handling of column-name and data-column counts when a column is excluded. Done means the dropped column no longer triggers the fill warning, while the resulting data remains x and y.

Written by the indexing model from the issue text.

Description

fread

Hi all!
Today I was using fread, on some data with one more column name than there is data, and I observed the following warning, which I think is a false positive. I would have expected no warning, because I told fread to drop the last column. Is this a bug?

> fread("x,y,z\n1,2",drop=3)
       x     y
   <int> <int>
1:     1     2
Warning message:
In fread("x,y,z\n1,2", drop = 3) :
  Detected 3 column names but the data has 2 columns. Filling rows automatically. Set fill=TRUE explicitly to avoid this warning.
> fread("x,y,z\n1,2",colClasses=list(NULL=3))
       x     y
   <int> <int>
1:     1     2
Warning message:
In fread("x,y,z\n1,2", colClasses = list(`NULL` = 3)) :
  Detected 3 column names but the data has 2 columns. Filling rows automatically. Set fill=TRUE explicitly to avoid this warning.
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.