ez.savex | R Documentation |
ez.writex
, wrapper of writeData
from the openxlsx packageuses openxlsx package which does not require java and is much faster, but has a slightly different interface/parameters from xlsx package.
Other parameters in writeData
. Overwrite existing file.
ez.savex(
x,
file = "RData.xlsx",
sheetName = "Sheet1",
withFilter = TRUE,
rowNames = FALSE,
colNames = TRUE,
...
)
ez.writex(
x,
file = "RData.xlsx",
sheetName = "Sheet1",
withFilter = TRUE,
rowNames = FALSE,
colNames = TRUE,
...
)
sheetName |
Name of the worksheet |
withFilter |
T/F auto add excel filter |
rowNames |
If TRUE, row names of x are written. |
colNames |
If TRUE, column names of x are written. |
gridLines |
A logical. If FALSE, the worksheet grid lines will be hidden. |
startCol |
A vector specifiying the starting column(s) to write df |
startRow |
A vector specifiying the starting row(s) to write df |
xy |
An alternative to specifying startCol and startRow individually. A vector of the form c(startCol, startRow) |
headerStyle |
Custom style to apply to column names. |
borders |
Either "surrounding", "columns" or "rows" or NULL. If "surrounding", a border is drawn around the data. If "rows", a surrounding border is drawn a border around each row. If "columns", a surrounding border is drawn with a border between each column. If "all" all cell borders are drawn. |
borderColour |
Colour of cell border |
borderStyle |
Border line style. |
returns file path
(x, file, sheetName="Sheet1", rowNames=FALSE,
colNames=TRUE)
## write to working directory
options("openxlsx.borderColour" = "#4F80BD") ## set default border colour
write.xlsx(iris, file = "writeXLSX1.xlsx", colNames = TRUE, borders = "columns")
write.xlsx(iris, file = "writeXLSX2.xlsx", colNames = TRUE, borders = "surrounding")
hs <- createStyle(textDecoration = "BOLD", fontColour = "#FFFFFF", fontSize=12,
fontName="Arial Narrow", fgFill = "#4F80BD")
write.xlsx(iris, file = "writeXLSX3.xlsx", colNames = TRUE, borders = "rows", headerStyle = hs)
## 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))
write.xlsx(l, "writeList1.xlsx")
## different sheets can be given different parameters
write.xlsx(l, "writeList2.xlsx", startCol = c(1,2,3), startRow = 2,
asTable = c(TRUE, TRUE, FALSE), withFilter = c(TRUE, FALSE, FALSE))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.