Learn R Programming

shinyCohortBuilder (version 0.4.0)

pre_post_stats: Generate structure of pre/post statistics

Description

The method exported only for custom extensions use.

`.pre_post_stats` returns the statistics having html tags structure. `.pre_post_stats_text` returns the same output but flatten to a single character object. The latter function works faster and supports vector arguments.

Usage

.pre_post_stats(
  current,
  previous,
  name,
  brackets = FALSE,
  percent = FALSE,
  stats = c("pre", "post")
)

.pre_post_stats_text( current, previous, name, brackets = TRUE, percent = FALSE, stats = c("pre", "post") )

Value

A `shiny.tag` class `span` object defining html structure of data/value statistics, or character object.

Arguments

current

Current step statistic value.

previous

Previous step statistic value.

name

Name displayed nearby the statistics output.

brackets

If TRUE, statistics will be displayed in brackets.

percent

Should current/previous ration in percentages be displayed?

stats

Vector of "pre" and "post" defining which statistics should be returned. "pre" for previous, "post" for current and NULL for none.

Examples

Run this code
.pre_post_stats(5, 10, "books")
.pre_post_stats_text(5, 10, "books")
.pre_post_stats(5, 10, "books", brackets = TRUE)
.pre_post_stats_text(5, 10, "books", brackets = TRUE)
.pre_post_stats(5, 10, "books", percent = TRUE)
.pre_post_stats_text(5, 10, "books", percent = TRUE)
.pre_post_stats_text(5:6, 10:11, "books", percent = TRUE)

Run the code above in your browser using DataLab