ropensci / writexl

Portable, light-weight data frame to xlsx exporter for R
https://docs.ropensci.org/writexl
Other
210 stars 17 forks source link

Empty string - remove space #20

Closed uwdk closed 6 years ago

uwdk commented 6 years ago

For character column types that also have NA values, NA values show with a space (" ") in the excel output and aren't empty. Original error was addressed in libxlsxwriter here: https://github.com/jmcnamara/libxlsxwriter/issues/121

This space can be removed now in this line of code

https://github.com/ropensci/writexl/blob/5ef824740bf79d679047654bc8c7dbacb3a6aa57/src/write_xlsx.c#L157-L158

fredguinog commented 6 years ago

+1

gulligull commented 6 years ago

+1 this is a problem when working with the output from R in excel sheets

jeroen commented 6 years ago

I guess there is no way to distinguish a NA from an empty string in xlsx? Can you give some example code of how the behavior is problematic?

jeroen commented 6 years ago

I have fixed it in https://github.com/ropensci/writexl/commit/e2819eed1aaa8004a2b9ec04a970618472727dc9. I'm still a bit concerned about this. For example if the final row(s) if your data only contain NA values, they completely disappear on the xlsx. But I guess that's how things work in Excel.

gulligull commented 6 years ago

Thank you for your reply. I will update the package to the latest version then. If the last rows are dropped when only containing NAs it might be a problem in some very specific cases, however, most people will not see this as a big setback i suppose.

Best, Patrick

Am 21. August 2018 um 11:45:43, Jeroen Ooms (notifications@github.com) schrieb:

I have fixed it in e2819ee https://github.com/ropensci/writexl/commit/e2819eed1aaa8004a2b9ec04a970618472727dc9. I'm still a bit concerned about this. For example if the final row(s) if your data only contain NA values, they completely disappear on the xlsx. But I guess that's how things work in Excel.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ropensci/writexl/issues/20#issuecomment-414616751, or mute the thread https://github.com/notifications/unsubscribe-auth/APz0h-tXOqQlHioFg1J1uJ-bw4Uh9zIeks5uS9bHgaJpZM4T8aL4 .