Skip to contents

[Experimental] server for adding views/cards to the Report.

For more details see the vignette: vignette("simpleReporter", "teal.reporter").

Usage

add_card_button_srv(id, reporter, card_fun)

Arguments

id

character(1) this shiny module's id.

reporter

Reporter instance.

card_fun

function which returns a ReportCard instance. It can have optional card, comment and label parameters. If card parameter is added, then the ReportCard instance is created for the user. Use comment parameter to pass it's value whenever you prefer with card$append_text() - if card_fun does not have comment parameter, then comment from Add Card UI module will be added at the end of the content of the card. If label parameter is provided, you can use it to customize appearance of the card name and use if to specify card content with card$append_text() - if card_fun does not have label parameter, then card name will be set to the name passed in Add Card UI module, but no text will be added to the content of the card.

Details

This module allows using a child of ReportCard instead of ReportCard. To properly support this, an instance of the child class must be passed as the default value of the card argument in the card_fun function. See below:

CustomReportCard <- R6::R6Class( # nolint: object_name_linter.
  classname = "CustomReportCard",
  inherit = teal.reporter::ReportCard
)

custom_function <- function(card = CustomReportCard$new()) {
  card
}