This function writes a report_spec object to the file system, using the specifications provided in the object.
The report object to write.
The function renders the report in the requested format, and writes it
to the location specified in the report
file_path parameter. Attempts
to write an object that is not of class "report_spec" will generate an error.
write_report function is a driver for very complex set of
rendering functions. The rendering functions
perform most of the advanced functionality of the rptr package:
generating spanning headers, page wrapping and breaking, creating stub
columns, etc. When things go wrong, they will usually go wrong during this
function call. For that reason, although this function can be part of
the pipeline that creates the report object, it is best to call
write_report independently, to help isolate any issues from the
report definition procedure.
The report spec, with settings modified during rendering. These modified settings can sometimes be useful for documentation, and for debugging issues with the procedure.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
library(rptr) 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) # Write the report to console writeLines(readLines(tmp))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.