library(reporter)
library(magrittr)
# Create temp file path
tmp <- file.path(tempdir(), "mtcars.txt")
# Create the table
tbl <- create_table(mtcars) %>%
titles("Table 1.0", "MTCARS Sample Report") %>%
footnotes("* NOTE: Data from 1974")
# Create the report object
rpt <- create_report(tmp) %>%
add_content(tbl, align = "left")
# Write the report to the file system
res <- write_report(rpt)
# Write the modified report object to the console
print(res)
# # A report specification: 1 pages
# - file_path: 'C:/Users/User/AppData/Local/Temp/RtmpWQybXs/mtcars.txt'
# - output_type: TXT
# - units: inches
# - orientation: landscape
# - line size/count: 108/45
# - content:
# # A table specification:
# - data: data.frame 'mtcars' 32 rows 11 cols
# - show_cols: all
# - use_attributes: all
# - title 1: 'Table 1.0'
# - title 2: 'MTCARS Sample Report'
# - footnote 1: '* NOTE: Data from 1974'
Run the code above in your browser using DataLab