options_fixed: Set options for a report (fixed width font)

Description Usage Arguments Details Value See Also Examples

View source: R/report_spec.r

Description

This function sets the options for a report with a fixed width font, such as a text report.

Usage

1
2
3
4
5
6
7
8
9
options_fixed(
  x,
  editor = NULL,
  cpuom = NULL,
  lpuom = NULL,
  min_margin = NULL,
  blank_margins = FALSE,
  font_size = 12
)

Arguments

x

The report spec.

editor

The expected text editor to use for printing. Assigning this parameter will set the cpuom and lpuom parameters appropriately for the editor. Valid values are 'notepad', 'word', 'wordpad', 'notepad++', and 'editplus'. If the editor parameter is used, any settings for cpuom and lpuom will be ignored.

cpuom

Characters per unit of measure of printed text. If units is inches, the default is 12. If units is centimeters (cm), the default is 4.687. This value will be used to determine how many characters can fit on a line.

lpuom

Lines per unit of measure of the printed text. Default for inches is 6. The default for centimeters (cm) is 2.55. This value will be used to determine the number of lines that can fit on a page.

min_margin

The editor minimum margin. When the units of measure is set to centimeters, this parameter defaults to 1. When the units of measure is set to inches, the parameter defaults to .394.

blank_margins

When this option is TRUE, rptr will use blank spaces and blank rows to create left and top margins, rather than rely on the editor to set margins. When used, editor margins should be set to zero. Valid values are TRUE and FALSE. Default is FALSE. This option is only valid for output_type = 'text'.

font_size

The size of the font in points. Default is 12pt. This option is only valid for output type PDF.

Details

The options_fixed function sets the characters per unit of measure (cpuom) and lines per unit of measure (lpuom) settings for the report. These settings determine how many characters and lines will fit within one unit of measure (uom), as specified on the create_report function.

These settings are important to ensure the report content stays within the available page size and margins. Because every text editor allows a different number of characters and lines on a page, these settings must be adjusted depending on the editor.

The options_fixed function provides a shortcut editor parameter to directly specify a popular editor. If this parameter is specified, the function will set the characters per unit of measure and lines per unit of measure for you. If the editor is not available in the editor parameter selections, for best results, you should set the cpuom and lpuom parameters manually. To determine your cpuom and lpuom, see the help for write_registration_file.

The min_margin parameter is used to set the minimum margin allowed by the editor. This value will be subtracted from the margin settings when the blank_margins option is used.

Value

The updated report spec.

See Also

create_report to create a report and set the unit of measure, write_registration_file to determine the characters and lines per unit of measure manually.

Other report: add_content(), create_report(), footnotes(), page_footer(), page_header(), set_margins(), titles(), write_report()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
library(rptr)
library(magrittr)

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

# Create the report object
rpt <- create_report(tmp, orientation = "portrait") %>% 
  titles("MTCARS Sample Report") %>% 
  add_content(create_table(mtcars)) %>% 
  options_fixed(editor = "notepad++")

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

dbosak01/reporter documentation built on Sept. 22, 2020, 3:34 p.m.