generate_rmd_file {TBox}R Documentation

Generate Rmd file

Description

This function creates the Rmd file which will be rendered in a specific format.

Usage

generate_rmd_file(
  content,
  output_format = c("word", "pdf", "html", "word_document", "pdf_document",
    "html_document"),
  code = TRUE,
  ...
)

Arguments

content

a string. The body of the Rmd file (for example code or text)

output_format

a string representing the output format. The values "pdf", "html" or "word" and their knitr equivalent "pdf_document", "html_document" or "word_document" are accepted.

code

a boolean. Should the content string have to be inserted in R chunk or is it just text? Default is TRUE (so the content will be inserted in R chunk).

...

other arguments passed to R chunk (for example eval = TRUE, echo = FALSE...)

Details

More information about the argument ... in the documentation of the function render_code.

Value

a vector of characters representing an Rmd file (each element being a line)

Examples


generate_rmd_file(content = "Bonjour tout le monde",
                  code = FALSE,
                  output_format = "word")
generate_rmd_file(content = "print(AirPassengers)",
                  code = TRUE,
                  output_format = "pdf",
                  eval = TRUE,
                  echo = FALSE)
generate_rmd_file(content = "plot(AirPassengers)",
                  code = TRUE,
                  output_format = "html_document",
                  eval = FALSE,
                  echo = TRUE)


[Package TBox version 0.2.2 Index]