An open API service indexing awesome lists of open source software.

https://github.com/kamapu/yamlme

R-Package for writing R-markdown documents from plain R code.
https://github.com/kamapu/yamlme

documentation rmarkdown yaml

Last synced: 4 months ago
JSON representation

R-Package for writing R-markdown documents from plain R code.

Awesome Lists containing this project

README

          

---
output:
github_document:
html_preview: false
---

```{r,echo=FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/"
)
```

# yamlme

[![cran checks](https://badges.cranchecks.info/worst/yamlme.svg)](https://cran.r-project.org/web/checks/check_results_yamlme.html)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/yamlme)](https://cran.r-project.org/package=yamlme)
[![DOI](https://zenodo.org/badge/297735831.svg)](https://zenodo.org/badge/latestdoi/297735831)


[![R-CMD-check](https://github.com/kamapu/yamlme/workflows/R-CMD-check/badge.svg)](https://github.com/kamapu/yamlme/actions)
[![Codecov test coverage](https://codecov.io/gh/kamapu/yamlme/branch/master/graph/badge.svg)](https://codecov.io/gh/kamapu/yamlme?branch=master)
[![CRAN_downloads](http://cranlogs.r-pkg.org/badges/yamlme)](https://cran.r-project.org/package=yamlme)
[![total downloads](http://cranlogs.r-pkg.org/badges/grand-total/yamlme)](https://cran.r-project.org/package=yamlme)
[![R-CMD-check](https://github.com/kamapu/yamlme/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/kamapu/yamlme/actions/workflows/R-CMD-check.yaml)

## Installing yamlme

You can install the last release from CRAN

```{r eval=FALSE}
install.packages("yamlme", dependencies = TRUE)
```

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

```{r eval=FALSE}
library(devtools)
install_github("kamapu/yamlme", build_vignettes = TRUE)
```

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

```{r}
library(yamlme)
```

## Create a document

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

```{r}
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
```

By this way it is possible to produce documents from plain R-code. This
document can be then rendered by the function `render_rmd()`.

```{r eval = FALSE}
render_rmd(input = my_document)
browseURL("my_document.html")
```

For more details, take a look on the vignette.

```{r eval = FALSE}
vignette("yamlme-intro")
```

## Similar packages

The package [`ymlthis`](https://github.com/r-lib/ymlthis) is targeting the
same tasks but using a different approach for it.

The most important dependencies of `yamlme` are
[`yaml`](http://biostat.app.vumc.org/wiki/Main/YamlR) and
[`rmarkdown`](https://rmarkdown.rstudio.com/).