pp_utils: Miscellaneous 'piecepackr' utility functions

pp_utilsR Documentation

Miscellaneous piecepackr utility functions

Description

cleave converts a delimiter separated string into a vector. inch(x) is equivalent to unit(x, "in"). is_color_invisible tells whether the color is transparent (and hence need not be drawn).

Usage

is_color_invisible(col)

inch(inches)

cleave(s, sep = ",", float = FALSE, color = FALSE)

file2grob(file, distort = TRUE)

Arguments

col

Color

inches

Number representing number of inches

s

String to convert

sep

Delimiter (defaults to ",")

float

If TRUE cast to numeric

color

if TRUE convert empty strings to "transparent"

file

Filename of image

distort

Logical value of whether one should preserve the aspect ratio or distort to fit the area it is drawn in

Examples

 cleave("0.5,0.2,0.4,0.5", float=TRUE)
 cleave("black,darkred,#050EAA,,", color=TRUE)

 is_color_invisible("transparent")
 is_color_invisible(NA)
 is_color_invisible("blue")
 is_color_invisible("#05AE9C")

 if (requireNamespace("grid", quietly = TRUE)) {
     identical(inch(1), grid::unit(1, "inch"))
 }


trevorld/piecepack documentation built on Jan. 19, 2024, 5:41 a.m.