writeTables: Write dataframes to .xlsx file

View source: R/data_functions.R

writeTablesR Documentation

Write dataframes to .xlsx file

Description

Write a dataframe or a named list of dataframes to a .xlsx file

Write a dataframe or a named list of dataframes to a .xlsx file

Usage

writeTables(
  data,
  file,
  rowNames = TRUE,
  adjwidths = TRUE,
  header = "bold",
  scale_styles = NULL,
  condition_styles = NULL,
  highlight_styles = NULL,
  check = FALSE,
  ...
)

Arguments

data

dataframe or a named list of dataframes

file

file

rowNames

print rownames to sheet

adjwidths

adjust column widths

header

format headers in bold font

scale_styles

color gradient styles, e.g. scale_styles = list(NES = c("#6200d0" = -1, "#ffffff" = 0, "#ffca0a" = 1))

condition_styles

conditional highlighting styles, e.g. condition_styles = list(padj = c(fontColour = "#ff2222", rule = "<=0.05"))

highlight_styles

value highlighting styles, e.g. highlight_styles = list(genes = list(fgFill = "#3be1ff", values = c("MTOR", "EGFR")))

check

test if .xlsx file can be re-imported without changes to data

...

See Also

openxlsx::writeData

openxlsx::writeData

Examples

writeTables(mtcars, file = "example.xlsx")
writeTables(list(mtcars = mtcars, iris = iris), file = "example.xlsx")

Write dataframes to .xlsx file

writeTables(mtcars, file = "example.xlsx")
writeTables(list(mtcars = mtcars, iris = iris), file = "example.xlsx")et
writeTables(mtcars, file = "example.xlsx", scale_styles = list(mpg = c("#ffffff", "#6200d0"), cyl = c("#ffffff" = 0, "#ffca0a" = 10)))
writeTables(mtcars, file = "example.xlsx", condition_styles = list(mpg = c(fontColour = "#6200d0", rule = ">20")))
writeTables(iris, file = "example.xlsx", highlight_styles = list(Species = list(fgFill = "#3be1ff", values = c("setosa", "virginica"))), rowNames = FALSE)

AlexanderKirchmair/datamisc documentation built on June 13, 2025, 5:26 a.m.