Skip to contents

Export formated pivot table to PowerPoint, Word or Excel document.

Usage

export(x, output, to = c("pptx", "docx", "xlsx"), ...)

export_pptx(x, output, ...)

export_docx(x, output, ...)

export_xlsx(x, output, label_value = "value", ...)

Arguments

x

A pivot_table or pivot_format object.

output

Path where to generate file.

to

Output document: "pptx" (PowerPoint), "docx" (Word) or "xlsx" (Excel).

...

Arguments passed to pivot_format if x isn't formated yet.

label_value

For Excel output, the label for variable containing the values.

Value

Path to output (invisibly).

Examples

library(flexpivot)
data("nobel_laureates")

pt <- pivot_table(nobel_laureates, rows = "category", cols = "gender")

# To PowerPoint
path_pptx <- tempfile(fileext = ".pptx")
export_pptx(pt, path_pptx)
browseURL(path_pptx)


# To Word
path_docx <- tempfile(fileext = ".docx")
export_docx(pt, path_docx)
browseURL(path_docx)


# To Excel
path_xlsx <- tempfile(fileext = ".xlsx")
export_xlsx(pt, path_xlsx)
browseURL(path_xlsx)


# Clean up
unlink(path_pptx)
unlink(path_docx)
unlink(path_xlsx)