Skip to content

kamapu/yamlme

Repository files navigation

yamlme

cran checks CRAN_Status_Badge DOI
R-CMD-check Codecov test coverage
CRAN_downloads total downloads

Installing yamlme

You can install the last release from CRAN

install.packages("yamlme", dependencies = TRUE)

or the current development version from GitHub, using the package devtools:

library(devtools)
install_github("kamapu/yamlme", build_vignettes = TRUE)

After installing the package have to be loaded in the current R-session.

library(yamlme)

Create a document

This package aims to save documents with their respective settings (yaml-head) in R-objects.

my_document <- list(
  title = "Mi First Document",
  author = "My Name",
  output = "html_document",
  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 <- as(my_document, "rmd_doc")
my_document
#> ---
#> title: Mi First Document
#> author: My Name
#> output: html_document
#> ---
#> 
#> # 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)
browseURL("my_document.html")

For more details, take a look on the vignette.

vignette("yamlme-intro")

Similar packages

The package ymlthis is targeting the same tasks but using a different approach for it.

The most important dependencies of yamlme are yaml and rmarkdown.