Learn R Programming

teal.modules.general (version 0.3.0)

create_sparklines: S3 generic for sparkline widget HTML

Description

Generates the sparkline HTML code corresponding to the input array. For numeric variables creates a box plot, for character and factors - bar plot. Produces an empty string for variables of other types.

Usage

create_sparklines(arr, width = 150, ...)

# S3 method for logical create_sparklines(arr, ...)

# S3 method for numeric create_sparklines(arr, width = 150, ...)

# S3 method for character create_sparklines(arr, ...)

# S3 method for factor create_sparklines(arr, width = 150, bar_spacing = 5, bar_width = 20, ...)

# S3 method for Date create_sparklines(arr, width = 150, bar_spacing = 5, bar_width = 20, ...)

# S3 method for POSIXct create_sparklines(arr, width = 150, bar_spacing = 5, bar_width = 20, ...)

# S3 method for POSIXlt create_sparklines(arr, width = 150, bar_spacing = 5, bar_width = 20, ...)

# S3 method for default create_sparklines(arr, width = 150, ...)

Value

Character string containing HTML code of the sparkline HTML widget.

Arguments

arr

vector of any type and length

width

numeric the width of the sparkline widget (pixels)

...

list additional options passed to bar plots of jquery.sparkline; see jquery.sparkline docs

bar_spacing

numeric the spacing between the bars (in pixels)

bar_width

numeric the width of the bars (in pixels)