as_excel | R Documentation |
The as_excel()
function relies on the openxlsx2
package for creating an Excel Workbook object in R. These objects can be saved using save_excel()
or export_xlsx()
.
as_excel(
...,
sheet_names = NULL,
autofilter = TRUE,
autowidth = TRUE,
widths = NULL,
rows_zebra = TRUE,
cols_zebra = FALSE,
freeze_top_row = TRUE,
digits = 2,
align = "center",
table_style = "TableStyleMedium2",
creator = Sys.info()["user"],
department = read_secret("department.name"),
project_number = project_get_current_id(ask = FALSE)
)
save_excel(xl, filename = NULL, overwrite = FALSE)
... |
data sets, use named items for multiple tabs (see Examples) |
sheet_names |
sheet names |
autofilter |
create autofilter on columns in first row. This can also be a vector with the same length as |
autowidth |
automatically adjust columns widths. This can also be a vector with the same length as |
widths |
width of columns, must be length 1 or |
rows_zebra |
create banded rows. This can also be a vector with the same length as |
cols_zebra |
create banded columns. This can also be a vector with the same length as |
freeze_top_row |
freeze the first row of the sheet. This can also be a vector with the same length as |
digits |
number of digits for numeric values (integer values will always be rounded to whole numbers), defaults to |
align |
horizontal alignment of text |
table_style |
style(s) for each table, see below. This can also be a vector with the same length as |
creator |
name of the creator of the workbook |
department |
name of the department of the workbook |
project_number |
project number, to add project ID as the subject of the workbook |
xl |
Excel object, as created with |
filename |
file location to save Excel document to, defaults to a random filename in the current folder |
overwrite |
overwrite existing file |
For the argument table_style
, use one or more of these table styles as character input. The default is TableStyleMedium2.
# creates a Workbook object
xl <- as_excel("this is a sheet" = mtcars,
"another sheet" = anscombe)
xl
# then save it with save_excel() or export_xlsx()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.