# NOT RUN {
## write to working directory
options("openxlsx.borderColour" = "#4F80BD") ## set default border colour
# }
# NOT RUN {
write.xlsx(iris, file = "writeXLSX1.xlsx", colNames = TRUE, borders = "columns")
write.xlsx(iris, file = "writeXLSX2.xlsx", colNames = TRUE, borders = "surrounding")
# }
# NOT RUN {
hs <- createStyle(textDecoration = "BOLD", fontColour = "#FFFFFF", fontSize=12,
fontName="Arial Narrow", fgFill = "#4F80BD")
# }
# NOT RUN {
write.xlsx(iris, file = "writeXLSX3.xlsx",
colNames = TRUE, borders = "rows", headerStyle = hs)
# }
# NOT RUN {
## Lists elements are written to individual worksheets, using list names as sheet names if available
l <- list("IRIS" = iris, "MTCATS" = mtcars, matrix(runif(1000), ncol = 5))
# }
# NOT RUN {
write.xlsx(l, "writeList1.xlsx", colWidths = c(NA, "auto", "auto"))
# }
# NOT RUN {
## different sheets can be given different parameters
# }
# NOT RUN {
write.xlsx(l, "writeList2.xlsx", startCol = c(1,2,3), startRow = 2,
asTable = c(TRUE, TRUE, FALSE), withFilter = c(TRUE, FALSE, FALSE))
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab