#' Read simple yaml file
#'
#' Simple yaml means one "key: value" pair per line
#'
#' @import hashmap
#'
#' @param filename String, path to file
#' @return A data table object indexed on key
#'
#' @export
read_simple_yaml = function(filename) {
inp = read.table(filename, header = FALSE, sep = ':')
keys = as.character(inp[, 1])
values = trimws(inp[, 2])
return(hashmap::hashmap(keys, values))
}
#' Write simple yaml file
#'
#' Simple yaml means one "key: value" pair per line
#'
#' @import hashmap
#'
#' @param filename String, path to file to write to
#' @param data Hashmap
#' @return Writes to file
#'
#' @export
write_simple_yaml = function(filename, data) {
sink(filename)
lapply(data$keys(), function(x) cat(x, ': ', data[[x]], '\n', sep = ''))
sink()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.