Skip to contents

A marker scheme maps one value to a shape family and another to a variant. Regular markers combine the two names with a hyphen. One-time values map directly to a marker, while none uses the scheme's fallback marker.

Usage

marker_encode(start, stop, once = FALSE, none = FALSE, scheme = "sda2028")

Arguments

start, stop

Vectors of values used to select shape family and variant. Numeric, character, and factor values are accepted. Values may be missing on rows selected by once or none when they are not needed.

once, none

Logical vectors marking one-time and no-screening rows. Scalars are recycled. The two flags cannot both be TRUE on a row.

scheme

"sda2028" or a list with named character vectors start, stop, and once, plus one character scalar none. The start and stop values are marker-name parts; once and none are complete icon names. Schemes may use bundled markers or user SVG names.

Value

A character vector of icon names, one per input row.

Details

The built-in "sda2028" scheme uses screening start ages 45/50/55 for square/circle/diamond and stop ages 70/75/80/85 for inset/hollow/cross/solid. One-time screening uses solid markers at ages 45/50/55, "plus-bold" at 60, and "triangle-down" at 65.

Examples

marker_encode(c(45, 50, NA), c(70, 85, NA), none = c(FALSE, FALSE, TRUE))
#> [1] "square-inset" "circle-solid" "circle-solid"
marker_encode(c(45, 60), c(NA, NA), once = TRUE)
#> [1] "square-solid" "plus-bold"   

other <- list(
  start = c(A = "square"), stop = c(B = "hollow"),
  once = c(A = "square-solid"), none = "circle-solid"
)
marker_encode("A", "B", scheme = other)
#> [1] "square-hollow"