For installing this package use devtools
:
library(devtools)
install_github("kamapu/yamlme", build_vignettes = TRUE)
After installing the package have to be loaded in the current R-session.
This package aims to save documents with their respective settings (yaml-head) in R-objects.
my_document <- write_rmd(title = "Mi First Document", author = "My Name",
output = "html_document", append = "# This is a comment in head",
body = txt_body(
"# Starting a working day",
"",
"At the beginning of every day I will do:",
"",
"- Say everyone \"Good morning!\"",
"- Start the coffe mashine",
"- Start the computer",
"- Read mails"))
my_document
#> ---
#> title: Mi First Document
#> author: My Name
#> output: html_document
#> # This is a comment in head
#> ---
#>
#> # Starting a working day
#>
#> At the beginning of every day I will do:
#>
#> - Say everyone "Good morning!"
#> - Start the coffe mashine
#> - Start the computer
#> - Read mails
By this way it is possible to produce documents from plain R-code. This document can be then rendered by the function render_rmd()
.
render_rmd(input = my_document, output_file = "my_document")
For more details, take a look on the vignette.
vignette("yamlme-intro")
Other R-packages with similar tasks are yaml
and ymlthis
, where the later is quite close but uses a different approach defining separated functions for different elements, while yamlme
uses a single function, which is quite open, writing the head in accordance to the argument provided in custom parameters. In addition, yamlme does not have any dependency.