Provides a simple class interface to set and change headers of .Rmd files.
R markdown files start with a preamble header that provides metadata and which allows the setting of parameters. The format of this header is a (modified) yaml, structured as follows:
---
title : Doc title
output: pdf_document
params:
sword: 'vorpal'
gallumphto: 'back'
---
rmdmanip
allows a user to load, edit and save the header using simple commands:
A file can be loaded through read.rmd(file)
or read.rmds(string)
, which provides and rmdmanip
object.
rmdfile = read.rmd('brillig.Rmd')
The header of the file can then be amended using put(item, value)
rmdfile = rmdfile %>% put('title', 'Beware the Jabberwock')
and parameters can be set using putParam(item, value)
rmdfile = rmdfile %>% putParam('borogroves', 'mimsy')
the final result can be extracted using dump
to write to file, or dumps
to write to a long string:
rmdfile %>% dump('brillig.Rmd')
rmdstring = rmdfile %>% dumps()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.