ropensci / writexl

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

writexl1.4.1 bug: Empty field -> "nan(snan) #64

Closed CHaasSoil closed 1 year ago

CHaasSoil commented 1 year ago

After reading (readxl) and writing (writexl) a xlsx file with R, an empty entry changes to "nan(snan)". See attachment: Change from before reading and writing

to after reading and writing

I and another stackoverflow user haven't had this problem before we updated to writexl 1.4.1. Any ideas? writexl1.4 solves the problem.

Example Code:

require(writexl)

require(readxl)

data<-read_excel("test_file.xlsx")

data$ERF_DATUM[3]<-NA

write_xlsx(data, "test_file.xlsx", col_names = TRUE, format_headers = TRUE)

Best greetings Christoph

jeroen commented 1 year ago

Can you link to your test_file.xlsx so that I can test the problem?

Lavinialau commented 1 year ago

Can you link to your test_file.xlsx so that I can test the problem?

We have seen the same issue when using writexl 1.4.1. The following example would show the same error without importing any file:

library(writexl)

# create data with timestamp
check <- data.frame(
  TestCol= rep("GV", 3),
  Time = c(Sys.time(), NA, NA)
)

# write data
write_xlsx(
  check,
  "check.xlsx"
)
jeroen commented 1 year ago

I think we already fixed this a while ago but it's not on CRAN yet. Can you try with writexl 1.4.2? You can install it from :

install.packages("writexl", repos = "https://ropensci.r-universe.dev")
Lavinialau commented 1 year ago

I think we already fixed this a while ago but it's not on CRAN yet. Can you try with writexl 1.4.2? You can install it from :

install.packages("writexl", repos = "https://ropensci.r-universe.dev")

Hi jeroen,

Thanks for the reply. Yes, I don't see the issue anymore with writexl 1.4.2. Thanks for your help.

jeroen commented 1 year ago

Writexl 1.4.2 is on cran now.