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_xlsx gives 2 errors when writing dates with NA - version 1.4.1 #63

Closed
mikecrobp opened this issue Oct 24, 2022 · 4 comments
Closed

Comments

@mikecrobp
Copy link

mikecrobp commented Oct 24, 2022

The following code generates 2 issues

TodayDate <- as.POSIXct.Date(Sys.Date(),tz = "UTC")

df <- as_tibble(cbind.data.frame(datecol = rep(TodayDate,2), numcol = 1:2))

df[1,1] = NA
df[1,2] = NA

write_xlsx(df, path = "wxl.xlsx")

Issues:

  1. Excel says the file is corrupt and then prompts to fix it
  2. NA in Date col is now shown as nan(snan)

No issue with 1.4.0

@jeroen
Copy link
Member

jeroen commented Oct 24, 2022

Hmm I don't think anything has changed in writexl, but maybe this is related to recent changes in base R wrt dates? Did you maybe test with r-devel?

@mikecrobp
Copy link
Author

I am using very vanilla environment. R 4.2.1 plus packages based on binaries and source.
Regressing 4.1.1 to 4.1.0 seemed to make the difference.

I am very happy to do any other testing you need

@jeroen jeroen closed this as completed in 876b74d Oct 24, 2022
@jeroen
Copy link
Member

jeroen commented Oct 24, 2022

Can you test with the new version?

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

@mikecrobp
Copy link
Author

Can you test with the new version?

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

Yes - that works for me. Thank you

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

No branches or pull requests

2 participants