Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

read_csv blank lines #680

Closed
hbeale opened this issue May 21, 2017 · 5 comments
Closed

read_csv blank lines #680

hbeale opened this issue May 21, 2017 · 5 comments
Labels
bug an unexpected problem or unintended behavior

Comments

@hbeale
Copy link

hbeale commented May 21, 2017

If there are blank lines before a header, the header is recognized as such but also included as a row. I came across this in read_tsv, but the min example was easier in read_csv.

e.g.

read_csv("\n\nfileName,variableName,fileDescription\nmy.tsv,awesomeStuff,that awesome stuff i made")
# A tibble: 2 × 3
fileName variableName fileDescription
<chr> <chr> <chr>
1 fileName variableName fileDescription
2 my.tsv awesomeStuff that awesome stuff i made

It may not be an additional problem, but in my case I'm also using comments:
read_csv("# this is a comment\n\nfileName,variableName,fileDescription\nmy.tsv,awesomeStuff,that awesome stuff i made", comment="#")

@slonik-az
Copy link

I ran into this problem today. Very annoying behavior. read.csv has blank.lines.skip parameter. read_csv should have something similar.

@jimhester jimhester added the bug an unexpected problem or unintended behavior label Dec 7, 2017
@jimhester
Copy link
Collaborator

If you know the number of blank / comment lines use the skip parameter.

@jimhester
Copy link
Collaborator

Closed by 6517708

@slonik-az
Copy link

  • It is very dangerous and bug-prone to rely on knowing number of blank lines. I would not let such code through a code review.
  • Empty lines can happen in the middle of the cvs file. In this case skip lines parameter is useless.

I still cannot get it -- why is it so difficult to skip over blank lines. What am I missing?

--Leo

@lock
Copy link

lock bot commented Sep 25, 2018

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Sep 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

3 participants