Created
April 16, 2019 11:28
-
-
Save jeromyanglim/c553b913b20dedaf6c4dc8e750c6d4db to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Function to write data.frame to xlsx spreadsheet | |
write_xlsx <- function(data, file, sheetname = "Sheet1", rowNames = TRUE, ...) { | |
require("openxlsx") | |
wb <- createWorkbook() | |
addWorksheet(wb, sheetname) | |
writeData(wb, sheetname, data, rowNames = rowNames, ...) | |
saveWorkbook(wb, file = file, overwrite = TRUE) | |
} | |
# Example | |
# data(cars) | |
# write_xlsx(cars, "cars.xlsx") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment