Skip to contents

[Experimental] A child of ReportCard that is used for teal specific applications. In addition to the parent methods, it supports rendering teal specific elements such as the source code, the encodings panel content and the filter panel content as part of the meta data.

Super class

teal.reporter::ReportCard -> TealReportCard

Methods

Inherited methods


Method append_src()

Appends the source code to the content meta data of this TealReportCard.

Usage

TealReportCard$append_src(src)

Arguments

src

(character(1)) code as text.

Returns

invisibly self

Examples

card <- TealReportCard$new()$append_src(
  "ggplot2::ggplot(iris, ggplot2::aes(x = Petal.Length)) + ggplot2::geom_histogram()"
)
card$get_content()[[1]]$get_content()


Method append_fs()

Appends the filter state list to the content meta data of this TealReportCard.

Usage

TealReportCard$append_fs(fs)

Arguments

fs

(FilteredData) with filter states.

Returns

invisibly self

Examples

# Artificial FilteredData class
fs <- R6::R6Class("FilteredData",
  public = list(
    get_filter_state = function() list(a = 1, b = 3),
    get_formatted_filter_state = function() "a = 1 and b = 3"
  )
)
fs_inst <- fs$new()
card <- TealReportCard$new()$append_fs(fs_inst)
card$get_content()[[1]]$get_content()


Method append_encodings()

Appends the encodings list to the content meta data of this TealReportCard.

Usage

TealReportCard$append_encodings(encodings)

Arguments

encodings

(list) list of encodings selections of the teal app.

Returns

invisibly self

Examples

card <- TealReportCard$new()$append_encodings(list("variable 1 is X"))
card$get_content()[[1]]$get_content()


Method clone()

The objects of this class are cloneable with this method.

Usage

TealReportCard$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples


## ------------------------------------------------
## Method `TealReportCard$append_src`
## ------------------------------------------------

card <- TealReportCard$new()$append_src(
  "ggplot2::ggplot(iris, ggplot2::aes(x = Petal.Length)) + ggplot2::geom_histogram()"
)
card$get_content()[[1]]$get_content()
#> [1] "ggplot2::ggplot(iris, ggplot2::aes(x = Petal.Length)) + ggplot2::geom_histogram()"

## ------------------------------------------------
## Method `TealReportCard$append_fs`
## ------------------------------------------------

# Artificial FilteredData class
fs <- R6::R6Class("FilteredData",
  public = list(
    get_filter_state = function() list(a = 1, b = 3),
    get_formatted_filter_state = function() "a = 1 and b = 3"
  )
)
fs_inst <- fs$new()
card <- TealReportCard$new()$append_fs(fs_inst)
card$get_content()[[1]]$get_content()
#> [1] "a = 1 and b = 3"


## ------------------------------------------------
## Method `TealReportCard$append_encodings`
## ------------------------------------------------

card <- TealReportCard$new()$append_encodings(list("variable 1 is X"))
card$get_content()[[1]]$get_content()
#> [1] "- variable 1 is X\n"