Package 'uofgdataanalyticsreport'

Title: R Markdown template to create assigment reports for UofG Data Analytics programmes.
Description: Provides an R Markdown template to use in UofG Data Analytics reports.
Authors: Carlos Yanez Santibanez [aut, cre]
Maintainer: Carlos Yanez Santibanez <[email protected]>
License: CC0
Version: 0.3.1.0003
Built: 2024-11-16 03:33:43 UTC
Source: https://github.com/carlosyanez/uofgdataanalyticsreport

Help Index


Corporate Design: Format Date

Description

Format date in local language format

Usage

cd_format_date(date, lang = default(rmarkdown::metadata$lang, "en-US"))

Arguments

date

Current date

lang

Language, either "de-DE", "de-CH" or "en_US"

Value

Character string, date in local format

Examples

cd_format_date("2012-01-01", "de-DE")
cd_format_date("2012-01-01", "en-US")

Corporate Design: knitr Chunk Options

Description

Set knitr chunk options in accordance with corporate design.

Usage

cd_knit_chunk_opts(
  twocolumn = default(rmarkdown::metadata$twocolumn, FALSE),
  fig.width = NULL,
  fig.height = NULL,
  fig.pos = "h",
  message = FALSE,
  echo = FALSE
)

Arguments

twocolumn

Use two-column mode? This will affect fig.width and fig.height.

fig.width

Figure width. If NULL, automatically chosen based on twocolumn.

fig.height

Figure height If NULL, automatically chosen based on twocolumn.

fig.pos

Floating modifier for figures

message

Should messages be shown?

echo

Should echo be shown?

Value

This function is called for its side effects and returns NULL, invisibly.

Examples

cd_knit_chunk_opts()

Corporate Design: Title Page

Description

Example function to generate a title page

Usage

cd_page_title(
  title = default(rmarkdown::metadata$title, "Title"),
  subtitle = default(rmarkdown::metadata$subtitle, "Subtitle"),
  date = default(rmarkdown::metadata$date, cd_format_date(Sys.Date()))
)

Arguments

title

Document title

subtitle

Document subtitle

date

Document creation date

Value

Object of class "knit_asis" (so that knitr will treat it as is). LaTeX code for title page.

Examples

cd_page_title(
  title = "My Title",
  subtitle = "My Subtitle"
)

Set Default Value

Description

Set default value of an argument. If x is NULL, default is used.

Usage

default(x, default = "")

Arguments

x

Character string, or NULL

default

If x is NULL, default is used.

Value

Character string

Examples

default(NULL)
default(NULL, "my default")
default("a string", "my default")

Glue LaTeX Code for Use in R Markdown

Description

Use the function to wrap literal LaTeX code in R. Use a raw string input (r"()") to automatically escape quotes and backslashes, as they are common in LaTeX. Expressions enclosed by ⁠<<⁠ and ⁠>>⁠ will be evaluated as R code.

Usage

indiedown_glue(x, .open = "<<", .close = ">>")

Arguments

x

Character, often as a raw string (r"()")

.open, .close

The opening and closing delimiter.

Details

indiedown_glue() uses a different default than the underlying glue::glue() (⁠<<⁠ and ⁠>>⁠), because braces are so common in LaTeX. Doubling the full delimiter (⁠<<<<⁠ and ⁠>>>>⁠) escapes it.

Value

Object of class "knit_asis" (so that knitr will treat it as is). Usually LaTeX code.

Examples

x <- "something"
indiedown_glue(r"(\LaTeX\ code with <<x>> substituted )")

Path helpers

Description

indiedown_path() creates a path to this package's indiedown assets, located at inst/indiedown.

indiedown_path_tex() creates a path that is usable in LaTeX, with all special characters escaped.

Usage

indiedown_path(...)

indiedown_path_tex(...)

Arguments

...

Path components, passed on to system.file().

Value

Character string, path to this package's indiedown assets

Examples

indiedown_path()

Customized R Markdown Document

Description

uofgdataanalyticsreport() is the main function of the uofgdataanalyticsreport package. Use as output: uofgdataanalyticsreport::uofgdataanalyticsreport in the R Markdown YAML header.

Usage

uofgdataanalyticsreport(...)

Arguments

...

Passed on to rmarkdown::pdf_document().

Value

R Markdown output format to pass to rmarkdown::render().