Content can be added to the dashboards pages, the sidebar or the navigation bar.

add_component(dashboard, component, ...)

add_to_sidebar(dashboard, component, ...)

add_colormap(dashboard, ...)

add_link(dashboard, ...)

# S4 method for i2dashboard,character
add_component(dashboard, component, page = "default", copy = FALSE, ...)

# S4 method for i2dashboard,`function`
add_component(dashboard, component, page = "default", ...)

# S4 method for i2dashboard,gg
add_component(dashboard, component, page = "default", ...)

# S4 method for i2dashboard,gt_tbl
add_component(dashboard, component, page = "default", ...)

# S4 method for i2dashboard,kableExtra
add_component(dashboard, component, page = "default", ...)

# S4 method for i2dashboard,Heatmap
add_component(dashboard, component, page = "default", ...)

# S4 method for i2dashboard,ANY
add_component(dashboard, component, page = "default", ...)

# S4 method for i2dashboard
add_link(
  dashboard,
  href,
  title = NULL,
  icon = NULL,
  align = c("right", "left"),
  target = NULL
)

# S4 method for i2dashboard
add_colormap(dashboard, map, name)

# S4 method for i2dashboard,character
add_to_sidebar(
  dashboard,
  component,
  page = "default",
  global = FALSE,
  copy = FALSE,
  ...
)

# S4 method for i2dashboard,`function`
add_to_sidebar(
  dashboard,
  component,
  page = "default",
  global = FALSE,
  copy = FALSE,
  ...
)

Arguments

dashboard

A i2dashboard.

component

An R object, function, or string.

...

Additional parameters passed to the components render function. In case of an image, parameters height and width can be used to define the dimensions of the image with CSS or provide an alternative text with image_alt_text.

page

The name of the page to add the component or sidebar to.

copy

Whether or not to copy images to dashboard@datadir.

href

The target of the link.

title

The link title.

icon

An optional link icon (see https://rmarkdown.rstudio.com/flexdashboard/using.html#icon-sets)

align

Optional argument that can be “left” or “right” (defaults = “right”) defining the alignment of the links in the navigation bar

target

An optional target (e.g. "_blank")

map

A character vector containing colors and possible the levels they map to (as names).

name

A name for the color mapping.

global

Whether or not to add the content to the global sidebar.

Value

The (modified) i2dashboard object.

Details

The options to add content in detail:

  • add_component adds content to a page of the dashboard by evaluating a function, or by including an object, a text or image file.

  • add_to_sidebar adds content to the dashboards global sidebar or to a pages local sidebar.

  • add_link adds a link to the navigation bar.

  • add_colormap adds a global color mapping to the dashboards colormaps.

The mechanism to add different types of content to a dashboards page or sidebar depends on the class of the object passed to the function add_component or add_to_sidebar:

  • A function will be evaluated and its return value is used as content.

  • A string that ends with .md or .txt will be used to open a file and use its content.

  • A string that ends with \.[png|jpg|jpeg|gif] will be used to include an image as content.

  • An R object (e.g. a htmlwidget) will be included if a suitable signature method is implemented.