draftRmdHTML: Draft a new R Markdown document with an embedded image

Description Usage Arguments Value See Also Examples

Description

draftRmdHTML copies a standard R Markdown (to HTML) document template while allowing for dynamic insertion and styling of an image (logo)

Usage

1
2
draftRmdHTML(dir, logoFile, width, height, moreLogoCSS = "",
  recursive = FALSE)

Arguments

dir

character value; directory to store template files

logoFile

character value; path to image file to embed

width

integer; styling width (in pixels) to use on embedded image

height

integer; styling height (in pixels) to use on embedded image

moreLogoCSS

character value; additional CSS to use on embedded image

recursive

logical value; should elements of dir other than the last be created? If TRUE, like the UNIX command mkdir -p.

Value

A logical value indicating the success (or failure) of copying the template files. If dir does not exist, its creation will be attempted. Template files are then copied to dir. Appropriate modifications are then made to template files based on logoFile, width, height and moreLogoCSS.

See Also

file.copy, readTemplate, image_uri

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
dir.create("test")
download.file("http://cran.us.r-project.org/Rlogo.svg", "test/Rlogo.svg")
draftRmdHTML("test", "test/Rlogo.svg", 148, 115, "margin-top: 20px;")
rmarkdown::render("test/template.Rmd")
dir.create("test2")
download.file(
    "https://www.rstudio.com/wp-content/uploads/2014/06/RStudio-Ball.png",
    "test2/RStudio-Ball.png"
)
draftRmdHTML("test2", "test2/RStudio-Ball.png", 150, 150)
rmarkdown::render("test2/template.Rmd")

dnegrey/spork documentation built on May 15, 2019, 9:40 a.m.