Skip to content

Leading whitespace causes header row duplication #747

@tdsmith

Description

@tdsmith

Adding whitespace at the beginning of a file (or between the end of a list of comments and a header row) causes the header row to be duplicated in the data.

Compare:
No leading whitespace; gives expected result

> read_csv("foo,bar\n1,2")
# A tibble: 1 x 2
    foo   bar
  <int> <int>
1     1     2

With leading whitespace; duplicates header row (and changes column types)

> read_csv("\nfoo,bar\n1,2")
# A tibble: 2 x 2
    foo   bar
  <chr> <chr>
1   foo   bar
2     1     2

readr is version 1.1.1. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions