The kpiwidget package provides an easy way to create KPI
(Key Performance Indicator) widgets for dashboards using
crosstalk shared data. This vignette demonstrates different
options and functionalities available in kpiwidget.
Before using kpiwidget, ensure that it is installed
along with crosstalk:
crosstalk allows dynamic filtering of data. Here, we add
a filter to select vehicles based on the number of gears:
kpiwidgetThe kpiwidget function provides a simple way to display
key performance indicators. The column parameter is
required, and by default, it calculates the count (number of rows in the
dataset).
The kpi parameter allows different types of
calculations. Below, we demonstrate various options available in
kpiwidget.
Calculates the sum of the selected column.
Computes the average (mean) of the selected column.
Finds the minimum value in the selected column.
Finds the maximum value in the selected column.
Counts the number of rows in the dataset.
Calculates the ratio of a subset defined with group1
parameter (e.g., cars with 4 cylinders) compared to the complement of
group1 filter (default setting for “ratio”) or to the subset defined
with group2 parameter.
default:
kpiwidget(
data = df_shared,
column = "mpg",
kpi = "mean",
comparison = "ratio",
group1 = ~ cyl == 4,
height = "25px"
)group2:
There are 32 records in unfiltered dataset.
The kpiwidget package provides a flexible way to display
KPIs in interactive dashboards. Using crosstalk, it enables
real-time filtering and comparison of data.