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

Windows newlines part of last column #87

Closed
tonyfischetti opened this issue Mar 13, 2015 · 7 comments
Closed

Windows newlines part of last column #87

tonyfischetti opened this issue Mar 13, 2015 · 7 comments

Comments

@tonyfischetti
Copy link

Hi,
When I use read_csv on a file with dos/windows line endings a carriage return "\r" becomes a part of the last column.

To replicate: I made a csv that looks like this
first,second,
1,2
3,4
then I used unix2dox to convert to dos line endings.

@tonyfischetti
Copy link
Author

I'm having trouble following the code flow but it you point me to the general file/files to manipulate I'd be happy to see if I can patch this myself.

@hadley
Copy link
Member

hadley commented Mar 13, 2015

@tonyfischetti unfortunately I don't think is a simple fix - the way the tokenizer is currently written would require some new states (STATE_NL, STATE_CR, I think) to do it correctly. (I think this is why people often write a lexer, then a tokenizer).

@tonyfischetti
Copy link
Author

Yeah, I was looking into it just now and that's what it seemed like :(

@jayhesselberth
Copy link

Wow readr is fast. But this issue is unfortunate because it means readr::read_csv is not a drop-in replacement for utils::read.csv in existing code. I had to fix up csv files with dos2unix first and then works as expected.

@kevinykuo
Copy link

+1 this is an issue for us since quite a bit of the data we get come in Excel spreadsheets...

@coolbutuseless
Copy link

Just came across this problem as well.

@JeffreySarnoff
Copy link

.. and the final column name has '"' postpended

@hadley hadley closed this as completed in 597cb43 Mar 31, 2015
@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
None yet
Projects
None yet
Development

No branches or pull requests

6 participants