set_margins: Set page margins

Description Usage Arguments Details Value See Also Examples

View source: R/report_spec.r

Description

Sets the page margins for the report. The units for this parameter can be inches or centimeters, depending on the units of measure specified on the create_report function.

Usage

1
set_margins(x, top = NULL, bottom = NULL, left = NULL, right = NULL)

Arguments

x

The report spec object.

top

The top margin.

bottom

The bottom margin.

left

The left margin.

right

The right margin.

Details

The margins set with set_margins will be used for the entire report. Units for the margins are specified by the units parameter on the create_report function. Available units are 'inches' and 'cm'. When the unit of measure is inches, default margins are 1 inch on the left and right, and .5 inches on top and bottom. When the unit of measure is centimeters, default margins are 2.54 cm on left and right, and 1.27 cm on top and bottom.

Note that when using output type of text, and not using the blank_margins option, setting the margins only reduces the area available for content on a page. You must still set the actual margins on the available editor to match those specified in set_margins. Any mismatch may result in content not fitting properly on the page. For best results, set the right and bottom margins to zero to allow for any overflow in spacing.

Value

The report_spec with margins set as desired.

See Also

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

Examples

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

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

# Define report
rpt <- create_report(tmp, orientation="portrait") %>%
  titles("MTCARS Report") %>% 
  set_margins(top = 1, bottom =1) %>% 
  add_content(create_table(mtcars)) 

# Write the report
write_report(rpt)

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