I do not understand the downward. I thought that some people would know how to do this using only the option, without the need to manually convert all NA.
I think this can be important and useful for other users, which I also asked on the openxlsx github development page, and they answered:
https://github.com/awalker89/openxlsx/issues/108
If anyone is interested if you upgrade the dev version with
devtools::install_github("awalker89/openxlsx")
You will get support for this feature.
the default behavior now converts NA to spaces. And if we want to have # N / A, we must use the keepNA = TRUE option; the keepNA = TRUE option saves # N / A
require('openxlsx') df <- head(iris) df[2,3] <- NA df[2,5] <- NA df[3,5] <- NaN openXL(write.xlsx(df, file = tempdir()))

require('openxlsx') df <- head(iris) df[2,3] <- NA df[2,5] <- NA df[3,5] <- NaN openXL(write.xlsx(df, file = tempdir(), keepNA = TRUE))

source share