This function calls the write_xlsx()
function in the writexl package
by Jeroen Ooms to write an Excel file (.xlsx).
write.xlsx(x, file = "Excel_Data.xlsx", col.names = TRUE, format = FALSE,
use.zip64 = FALSE, check = TRUE)
a matrix, data frame or (named) list of matrices or data frames that will be written in the Excel file.
a character string naming a file with or without file extension
'.xlsx', e.g., "My_Excle.xlsx"
or "My_Excel"
.
logical: if TRUE
, column names are written at the top
of the Excel sheet.
logical: if TRUE
, column names in the Excel file are
centered and bold.
logical: if TRUE
, zip64 to enable support for 4GB+ Excel
files is used.
logical: if TRUE
(default), argument specification is checked.
Jeroen Ooms
This function supports strings, numbers, booleans, and dates.
Jeroen O. (2021). writexl: Export Data Frames to Excel 'xlsx' Format. R package version 1.4.0. https://CRAN.R-project.org/package=writexl
read.xlsx
, write.sav
, write.dta
,
write.mplus
if (FALSE) {
# Example 1: Write Excel file (.xlsx)
dat <- data.frame(id = 1:5,
gender = c(NA, 0, 1, 1, 0),
age = c(16, 19, 17, NA, 16),
status = c(1, 2, 3, 1, 4),
score = c(511, 506, 497, 502, 491))
write.xlsx(dat, file = "Excel.xlsx")
# Example 2: Write Excel file with multiple sheets (.xlsx)
write.xlsx(list(cars = cars, mtcars = mtcars), file = "Excel_Sheets.xlsx")
}
Run the code above in your browser using DataLab