DocExport: Export objects into a Word document

Description Usage Arguments Value Examples

Description

Export flextable objects or ggplot2 figures into a Word document

Usage

1
2
DocExport(filename, tables = NULL, tables_title = NULL,
  figures = NULL, figures_title = NULL, base_docx_filename = NULL)

Arguments

filename

the name of the target Word document to create

tables

a named list of flextable objects

tables_title

a named list of table titles. The names should correspond to those of tables parameter

figures

a named list of ggplot() objects

figures_title

a named list of figure titles. The names should correspond to those of figures parameter

base_docx_filename

the name of another Word file to inherit data from

Value

The message in console in case of successful Word document creation

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#export simple flextable objects
t_flx_obj <- CreateFLX(list(data = mtcars[1:8,]))
t_flname <- paste0(getwd(), "/test_table.docx")
DocExport(filename = t_flname,
          tables = list(table1 = t_flx_obj),
          tables_title = list(table1 = "Test table"))
t_flx_obj_sec <- CreateFLX(list(data = mtcars[9:16,]))
t_flname_sec <- paste0(getwd(), "/test_table_second.docx")
DocExport(filename = t_flname_sec,
          tables = list(table2 = t_flx_obj_sec),
          tables_title = list(table2 = "Test table second"),
          base_docx_filename = t_flname)

Gargantua404/SmoothExport documentation built on July 1, 2019, 1:27 a.m.