Creates a report shell to which you may add titles, footnotes, content, etc.

create_report(
file_path = "",
output_type = "TXT",
orientation = "landscape",
units = "inches",
paper_size = "letter",
missing = ""
)

## Arguments

file_path The output path of the desired report. Either a full path or a relative path is acceptable. This parameter is not required to create the report_spec object, but will be required to write the report. In addition, the file extension is not required. If the file extension is not supplied, the write_report function will add a file extension based on the output_type specified. The report output type. Default is "TXT". Valid values are "TXT", "RTF", and "PDF". The page orientation of the desired report. Valid values are "landscape" or "portrait". The default page orientation is "landscape". Specifies the units of measurement. This setting will indicate the units for columns widths, margins, paper size, and other measurements. Valid values are "inches" or "cm" (centimeters). Default value is "inches". The expected paper size on which the report may be printed. The paper_size will determine how much text can fit on one page. Valid values are "letter", "legal", "A4", and "RD4". Default is "letter". How to display missing values in the report. Default is to replace them with an empty string, which removes them from the report. To display missing values as is, set the missing parameter to NULL. To replace missing values with a character string (such as ".", "-", or "") pass the desired character string to the missing parameter.

## Value

A new report_spec object.

## Details

This function is the constructor for the report object. The report object contains information needed to create a report. The object is defined as an S3 object, and has a class of 'report_spec'.

The report object holds information concerning report page size, orientation, titles, footnotes, page header, page footer, margins, and other options. Use the add_content function to add content to the report. The report may be written to a file using the write_report function.

## Report family of functions

The report is the primary container for report specifications. The following functions add additional specifications to the report object initialized with create_report.

• titles to add titles to the report.

• footnotes to add footnotes to the report.

• title_header to add a title header to the report.

• page_header to add a page header to the report.

• page_footer to add a page_footer to the report.

• add_content to add content to the report.

• options_fixed to set options for fixed-width output.

• add_content to add content to the report.

• write_report to write the report to the file system.

The report family of functions are pipe-friendly. After creating the report, you may pipe the object to any of the above functions to append additional options.

Note that PDF output has some limitations not found in TXT and RTF output. See NotesOnPDF for additional information.

create_table, create_text, and create_plot functions to create content for the report.

Other report: add_content(), footnotes(), options_fixed(), page_by(), page_footer(), page_header(), print.report_spec(), set_margins(), title_header(), titles(), write_report()

## Examples

library(reporter)
library(magrittr)

# Create temp file path
tmp <- file.path(tempdir(), "airquality.txt")

# Prepare Data
dat <- airquality[sample(1:153, 15), ]
dat$Month <- as.Date(paste0("1973-", dat$Month, "-01"))

# Define table
tbl <- create_table(dat, show_cols = c("Month", "Day", "Wind", "Temp", "Ozone")) %>%
titles("Table 9.6", "Air Quality Sample Report") %>%
column_defaults(width = .5) %>%
define(Month, format = "%B", align = "left", width = 1) %>%
define(Temp, format = "%.0f") %>%
footnotes("* New York, May to September 1973")

# Define report
rpt <- create_report(tmp, orientation = "portrait",  missing = "-") %>%

# Write the report to the file system
write_report(rpt)

# Write the report to the console

#                      Table 9.6
#              Air Quality Sample Report
#
#      Month           Day   Wind   Temp  Ozone
#      ----------------------------------------
#      July              8    6.3     92     97
#      July              9    5.7     92     97
#      August            1    6.9     81     39
#      July             23   11.5     82      -
#      June              9   13.8     90     71
#      July             12   14.3     73     10
#      July              4   10.9     84      -
#      May              31    7.4     76     37
#      September        30   11.5     68     20
#      June             25      8     75      -
#      June             28   11.5     80      -
#      August           18    7.4     76     23
#      June             20   10.3     76     13
#      July              1    4.1     84    135
#      May              23    9.7     61      4
#
#      * New York, May to September 1973