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

write_csv should have an option to specify end of line character #857

Closed
kerry-ja opened this issue May 23, 2018 · 7 comments · Fixed by sthagen/tidyverse-readr#3
Closed
Labels
feature a feature request or enhancement
Milestone

Comments

@kerry-ja
Copy link

kerry-ja commented May 23, 2018

There should be an option to specify what character should be on the end of a line. I am dealing with a process of loading data to a database from .csv files, and it only works when the eol is a Carriage Return Line Feed (as is done when Windows Excel saves a .csv file). The current function saves with a Line Feed, and I do not see any option to change this, unless I missed it.

@allimo
Copy link

allimo commented Sep 6, 2018

I'm having the same issue - I have to send data to an external client who is expecting the EOL to be the Windows version (CRLF) and when using write_delim they're not able to process the file because it's written with just "\n" at end of line. There's an eol argument in write.table, and on Windows it appears to default to "\r\n" as expected (which I can use as a workaround), but it'd be awesome if the tidyverse version behaved similarly to write.table for EOLs.

@nzbart
Copy link

nzbart commented Sep 24, 2018

I'm having the same problem. If you're wondering whether there's an undocumented way to get this to work (as I was), there isn't. The newline is hard-coded in write_delim.cpp in the stream_delim_row function:

output << '\n';

I'm not sure of the most appropriate way to make this configurable,

@jimhester jimhester added the feature a feature request or enhancement label Nov 13, 2018
@jimhester jimhester added this to the backlog milestone Nov 15, 2018
@mcleanle
Copy link

mcleanle commented Nov 27, 2018

I'm having the same issue using write_tsv. Another workaround - you can change the EOL character with one click in Notepad++, if the file is small enough to open in that program.

@s-fleck
Copy link

s-fleck commented Apr 3, 2019

Any updates on this? I need to produce excel compatible .csv mit windows line endings and this is a blocker for me :/

@bryantchambers
Copy link

bryantchambers commented Sep 24, 2019

I agree - i am uploading a large set of genes to a data base for analysis... and there is no way to just simply change this using write_tsv etc...

@ibwoo
Copy link

ibwoo commented Nov 13, 2019

Also encountering an error discovered when a specific installation of Excel adds a blank row between all rows. I think it is interpreting LF and CR as two new lines. Several other Mac and Windows installations of Excel don't seem have this issue when opening the file, but it seems easier to fix at the write_tsv stage than to find the seemingly non-existent setting in Excel or by editing every saved TSV to remove carriage returns.

@TiRoX
Copy link

TiRoX commented Mar 20, 2020

R also adds random line breaks after a specific amount of symbols on a line - without eol flags, which makes reading it again impossible, as a line break may also be recognized as a start of a new entry (e.g. python pandas)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants