Package 'ehastyle'

Title: Default styles for EcoHealth Alliance Reports
Description: Contains R Markdown templates and ggplot2 themes suitable for EHA work
Authors: Noam Ross [aut, cre], Emma Mendelsohn [aut], Collin Schwantes [aut], EcoHealth Alliance [cph]
Maintainer: Collin Schwantes <[email protected]>
License: MIT
Version: 0.1.1
Built: 2024-10-24 04:13:56 UTC
Source: https://github.com/ecohealthalliance/ehastyle

Help Index


Check that all templates build properly

Description

Opens markdown templates as rmd files and/or renders them into their appropriate format.

Usage

check_templates(
  style = c("classic", "avenir", "predict"),
  format = c("pptx", "xar", "flex"),
  aspect = c("4x3", "16x9"),
  check_all = FALSE,
  render = TRUE,
  outdir = "./",
  recursive = TRUE
)

Arguments

style

String. One of "classic", "avenir", or "predict"

format

String. One of "pptx","xar", or"flex"

aspect

String. One of "4x3" or "16x9"

check_all

Logical. Should we open all the templates as RMDs?

render

Logical. Should we render the templates we open?

outdir

String. Where should files be stored

recursive

Logical. Should subfolders of outdir be created


Avenir EHA powerpoint template

Description

Styles for eha rmarkdown ppt. Used with a template to create presentations that dynamically update with your data.

Usage

eha_avenir_pptx(
  aspect = "16x9",
  master = "EcoHealth Alliance",
  toc = FALSE,
  toc_depth = 2,
  fig_width = 9.4,
  fig_height = 4.24,
  fig_caption = TRUE,
  df_print = "default",
  keep_md = FALSE,
  smart = TRUE,
  md_extensions = NULL,
  slide_level = NULL,
  pandoc_args = NULL
)

Arguments

aspect

String. Aspect ratio for power point slides. Either "16x9" or "4x3". Default is "16x9"

master

String. Name of slide master for template ppt. Use ppt_layout to see name of master and layouts.

toc

Logical. Should the slides have a table of contents? Default is FALSE

toc_depth

Numeric. How many levels should the table of contents have. Default is 2.

fig_width

Numeric. Width of figures. Default is 9.4

fig_height

Numeric. Height of figures. Default is 4.24

fig_caption

Logical. Should figures have captions? Default is TRUE

df_print

String. Print data frames? Default is "default"

keep_md

Logical. Should markdown document be kept? Default is FALSE

smart

Logical. Produce typographically correct outs. Default is TRUE

md_extensions

String. Additional markdown extensions. Default is NULL

slide_level

Numeric. Defines the heading level that defines individual slides. Default is NULL

pandoc_args

Arguments to pass to pandoc

See Also

powerpoint_presentation, rpptx_document


EHA Xaringan Theme

Description

A function to produce an EHA Xaringan theme with the avenir font. This function leans on style_mono_light for many of the theme arguments. It uses moon_reader to create the markdown renderable object. Unlike eha_classic_pptx, you cannot create editable plots with dml. However, you can include interactive html widgets.

Usage

eha_avenir_xar(aspect = "16x9", self_contained = TRUE, ...)

Arguments

aspect

String. Aspect ratio for slides. Either "16x9" or "4x3". Default is "16x9"

self_contained

Whether to produce a self-contained HTML file by embedding all external resources into the HTML file.

...

other arguments passed to moon_reader or html_document

Value

xaringan theme


Classic EHA powerpoint template

Description

Styles for eha rmarkdown ppt. Used with a template to create presentations that dynamically update with your data.

Usage

eha_classic_pptx(
  aspect = "16x9",
  master = "EcoHealth Alliance",
  toc = FALSE,
  toc_depth = 2,
  fig_width = 9.4,
  fig_height = 4.24,
  fig_caption = TRUE,
  df_print = "default",
  keep_md = FALSE,
  smart = TRUE,
  md_extensions = NULL,
  slide_level = NULL,
  pandoc_args = NULL
)

Arguments

aspect

String. Aspect ratio for power point slides. Either "16x9" or "4x3". Default is "16x9"

master

String. Name of slide master for template ppt Use ppt_layout to see name of master and layouts.

toc

Logical. Should the slides have a table of contents? Default is FALSE

toc_depth

Numeric. How many levels should the table of contents have. Default is 2.

fig_width

Numeric. Width of figures. Default is 9.4

fig_height

Numeric. Height of figures. Default is 4.24

fig_caption

Logical. Should figures have captions? Default is TRUE

df_print

String. Print data frames? Default is "default"

keep_md

Logical. Should markdown document be kept? Default is FALSE

smart

Logical. Produce typographically correct outs. Default is TRUE

md_extensions

String. Additional markdown extensions. Default is NULL

slide_level

Numeric. Defines the heading level that defines individual slides. Default is NULL

pandoc_args

Arguments to pass to pandoc

See Also

powerpoint_presentation, rpptx_document


EHA Xaringan Theme

Description

A function to produce an EHA Xaringan theme with the classic font. This function leans on style_mono_light for many of the theme arguments. It uses moon_reader to create the markdown renderable object. Unlike eha_classic_pptx, you cannot create editable plots with dml. However, you can include interactive html widgets.

Usage

eha_classic_xar(aspect = "16x9", self_contained = TRUE, ...)

Arguments

aspect

String. Aspect ratio for slides. Either "16x9" or "4x3". Default is "16x9"

self_contained

Whether to produce a self-contained HTML file by embedding all external resources into the HTML file.

...

other arguments passed to moon_reader or html_document

Value

xaringan theme

Note

There is an issue using sysfonts with M1 mac machines thereforetheme_xaringan is not able to use google_font when creating ggplot themes.


EcoHealth Alliance Flex Dashboard Theme

Description

Function to create a custom flexdashboard theme for EHA.

Usage

eha_flex_dashboard(
  orientation = "rows",
  bg = "#224A55",
  fg = "#5EB9D6",
  primary = "#97C83E",
  secondary = "#B0A28A",
  version = 4,
  fontUrl = "https://font-avenir.s3.us-east-2.amazonaws.com/AvenirLTW04-85Heavy.woff2",
  family = "Avenir",
  style = "normal",
  weight = "500",
  ...
)

Arguments

orientation

Determines whether level 2 headings are treated as dashboard rows or dashboard columns.

bg

Background color for bs_theme

fg

Foreground color for bs_theme

primary

Primary color for bs_theme

secondary

Secondary color for code bs_theme

version

Bootstrap version to use with bs_theme

fontUrl

URL where font is hosted

family

String. Name of font family when using fontURL

style

String. Name of font style. Choose from normal, italic,oblique, initial, or inherit

weight

String. Defines from thin to thick characters. 400 is the same as normal, and 700 is the same as bold. Can also use normal, bold, bolder, or lighter

...

Additional arguments to be passed to flex_dashboard

Value

function

CSS Font Properties

See W3 description of font property for additional details about customizing fonts.

See Also

flexdashboard::flex_dashboard() bslib::bs_theme()


EcoHealth Alliance Flex Dashboard Theme - Light

Description

Function to create a custom flexdashboard theme for EHA.

Usage

eha_flex_dashboard_light(
  orientation = "rows",
  bg = "#f7fdff",
  fg = "#5EB9D6",
  primary = "#97C83E",
  secondary = "#B0A28A",
  version = 4,
  fontUrl = "https://font-avenir.s3.us-east-2.amazonaws.com/AvenirLTW04-85Heavy.woff2",
  family = "Avenir",
  style = "normal",
  weight = "500",
  ...
)

Arguments

orientation

Determines whether level 2 headings are treated as dashboard rows or dashboard columns.

bg

Background color for bs_theme

fg

Foreground color for bs_theme

primary

Primary color for bs_theme

secondary

Secondary color for code bs_theme

version

Bootstrap version to use with bs_theme

fontUrl

URL where font is hosted

family

String. Name of font family when using fontURL

style

String. Name of font style. Choose from normal, italic,oblique, initial, or inherit

weight

String. Defines from thin to thick characters. 400 is the same as normal, and 700 is the same as bold. Can also use normal, bold, bolder, or lighter

...

Additional arguments to be passed to flex_dashboard

Value

function

CSS Font Properties

See W3 description of font property for additional details about customizing fonts.

See Also

flexdashboard::flex_dashboard() bslib::bs_theme()


Create a letter on EHA letterhead

Description

This is a thin wrapper around the linl::linl() function which prints letters, automatically using the EHA letterhead. See that function's options for further

Usage

eha_letter(...)

Arguments

...

Additional parameters to pass to linl


Open EHA Powerpoint templte

Description

Open avenir, classic, and predict powerpoint templates. Providing no arguments will open all six templates. Providing either an aspect or a template will return all the corresponding templates. For example, if classic is provided to template, then classic 16x9 and classic 4x3 will be opened.

Usage

eha_pptx_template(
  template = c("classic", "avenir", "predict"),
  aspect = c("16x9", "4x3"),
  outdir = "./",
  recursive = TRUE
)

Arguments

template

String. Either classic or avenir. Defines the template to be use.

aspect

String. Either 16x9 or 4x3. Defines the aspect ratio of the slides

outdir

String. Where should files be copied to before opening?

recursive

Logical. Should elements of the path other than the last be created? If true, like the Unix command mkdir -p. See dir.create

Value

pptx

Examples

#open all the templates
## Not run: eha_pptx_template()

R Markdown format for EHA Outbreak Scenarios Reports

Description

R Markdown format for EHA Outbreak Scenarios Reports

Usage

outbreak(
  self_contained = TRUE,
  lib_dir = NULL,
  keep_md = FALSE,
  cache_prefix = "cache/",
  ...
)

Arguments

self_contained

Include all dependencies

lib_dir

Local directory to copy assets

keep_md

Keep knitr-generated markdown

cache_prefix

String. Prefix for cache

...

Additional function arguments to pass to the base R Markdown HTML output formatter

theme

Bootstrap theme

mathjax

Include mathjax, "local" or "default"

pandoc_args

Other arguments to pass to pandoc


Create output for Word document

Description

Create output for Word document

Usage

outbreak_word(
  cache_prefix = "cache/",
  keep_md = FALSE,
  proposal = FALSE,
  usaid = FALSE,
  usaid_panel = 1,
  ...
)

Arguments

cache_prefix

String. Prefix for cache

keep_md

Logical. Keep the markdown file generated by knitting. Note that if this is TRUE then clean_supporting will always be FALSE.

proposal

Logical. Should the proposal format be used.

usaid

Logical. Should the USAID format be used

usaid_panel

Numeric. Which USAID sidebar image should be used (1,2, or 4)?

...

Additional arguments to pass to word_document

See Also

knitr_options, output_format, word_document


Check PPT template for duplicates

Description

Checks for duplicate PH elements that would break rendering.

Usage

ph_duplicate_check(ppt_template, print = FALSE)

Arguments

ppt_template

String. Path to ppt template

print

Logical. Should the dataframe be printed?

Value

dataframe

See Also

read_pptx, layout_properties


Get package resources

Description

This function allows you to easily source package resources like images or style sheets. The function will return a file path to a resource stored in your package.

Usage

pkg_resource(...)

Arguments

...

arguments to pass to system.file

Value

string

Examples

logoEHA <- pkg_resource("eha_icon_logo.png")
print(logoEHA)

Check Powerpoint

Description

Checks for duplicate ph elements using ph_duplicate_check and matching master arguments using ppt_layout.

Usage

ppt_check(ppt_template, master, print = FALSE)

Arguments

ppt_template

String. Path to ppt template

master

String. Name of master slide template

print

Logical. Should items be printed

Value

message


Print Powerpoint Layout

Description

Convenience wrapper forlayout_summary used to debug issues with powerpoint templates. Returns a list with first element containing the master names and the second element containing layout and master names for a given ppt.

Usage

ppt_layout(ppt_template, print = FALSE)

Arguments

ppt_template

String. Path to ppt file

print

Logical. Should layout be printed

Value

data.frame


Synthetic speaker locations for airtables example.

Description

Dataset containing speaker locations and labels.

Usage

speakerLocations

Format

A data frame with 8 rows and 6 variables:

affiliation

institution associated with speaker

cities

location of institution

lat

latitude of institution

lng

longitude of institution

totalTalks

number of talks from that institution

label

summary of institution statistics

...

Source

airtable app id appwlxIzmQx5njRtQ as of 24 June 2021