Created
December 27, 2016 14:45
-
-
Save kzktmr/f8f6c4447ede5ee56418fe4c2b136594 to your computer and use it in GitHub Desktop.
Export csv file that can be opened by Excel for Mac.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
write_excel_mac_csv <- function(x, path, na = "NA"){ | |
tmp <- tempfile() | |
readr::write_tsv(x, tmp, na = na) | |
path <- paste0("'", path, "'") | |
system(paste("(printf '\xff\xfe'; iconv -f utf-8 -t utf-16le", tmp, ") >", path)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment