i2dashboard-content: Add content to an i2dashboard object.

Description Usage Arguments Details Value Examples

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
add_component(dashboard, component, ...)

add_to_sidebar(dashboard, component, ...)

add_colormap(dashboard, ...)

add_link(dashboard, ...)

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

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

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

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

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

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

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

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

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

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

## S4 method for signature '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.

Details

The options to add content in detail:

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()':

Value

Returns the modified i2dashboard object.

If something went wrong during the addition, the unmodified i2dashboard object is returned.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
library(magrittr)
i2dashboard() -> dashboard
myFunction <- function(dashboard) paste0("### Generate component\n\n",
    "Lorem ipsum dolor sit amet\n")

dashboard %<>% add_component(component = myFunction)
dashboard %<>% add_component(component = plotly::plot_ly(mtcars, x=~wt, y=~hp),
    title = "Include htmlwidget")

## Similarly, it is possible to insert files and images into components:
## dashboard %<>% add_component(component = "sample.txt", title = "Include text")
## dashboard %<>% add_component(component = "sample.jpg", title = "Include image")

dashboard %<>% add_to_sidebar(component = myFunction)

## Similarly, it is possible to insert files and images into the sidebar:
## dashboard %<>% add_to_sidebar(component = "sample.txt", package="i2dash")
## dashboard %<>% add_to_sidebar(component = "sample.jpg", package="i2dash")

colors <- c("l1" = "#F7FCFD", "l2" ="#E5F5F9", "l3" = "#CCECE6")
dashboard %<>% add_colormap(map = colors, name = "test")

dashboard %<>% add_link(href = "www.sample_url.net", title = "MyLink", align = "left")

loosolab/i2dash documentation built on April 8, 2021, 12:41 a.m.