Learn R Programming

carbonr (version 0.2.1)

gg_value_box: Create a Value Box for Reports

Description

This function creates a value box for use in reports.

Usage

gg_value_box(values, information, icons)

Value

A ggplot2 object with a value box for report use.

Arguments

values

A vector of numeric values to be displayed in the value box.

information

A vector of strings providing information or labels for the values.

icons

A vector of Font Awesome unicode symbols to be displayed as icons.

Details

This function creates a value box with customizable values, information, and icons. The function takes inputs for the values, information, icons, and color of the value box. The values and information are provided as vectors, while the icons are specified using Font Awesome unicode symbols. The color of the value box can be customized using a factor variable. The resulting value box is a ggplot2 object that can be further customized or combined with other plots or elements in a report.

References

Modified from Stack Overflow post: https://stackoverflow.com/questions/47105282/valuebox-like-function-for-static-reports

Examples

Run this code
# Create a value box with custom values and icons
gg_value_box(
  values = c(100, 500, 1000),
  information = c("Sales", "Revenue", "Customers"),
  icons = c("\U0000f155", "\U0000f155", "\U0000f0f7")
)

Run the code above in your browser using DataLab