set_formatter_star: Set star rating formatter

View source: R/columns.R

set_formatter_starR Documentation

Set star rating formatter

Description

Set star rating formatter

Usage

set_formatter_star(widget, column, number_of_stars = NA, hoz_align = "center")

Arguments

widget

A tabulator() HTML widget.

column

The name of the column the formatter is applied to.

number_of_stars

The maximum number of stars to be displayed. If set to NA, the maximum value of the column is used.

hoz_align

(character): The horizontal alignment of the column.

Value

The updated tabulator() HTML widget

Examples

data <- data.frame(
  Passengers = c("Hans", "Franz", "Ferdinand", "Julia"),
  PassengerClass = c(1, 2, 1, 3)
)

tabulator(data, width = 200) |>
  set_formatter_star("PassengerClass", number_of_stars = max(data$PassengerClass))

rtabulator documentation built on Sept. 23, 2024, 5:11 p.m.