cleave() converts a delimiter separated string into a vector.
inch(x) is equivalent to grid::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
TRUEcast to numeric- color
if
TRUEconvert 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)
#> [1] 0.5 0.2 0.4 0.5
cleave("black,darkred,#050EAA,,", color=TRUE)
#> [1] "black" "darkred" "#050EAA" "transparent" "transparent"
is_color_invisible("transparent")
#> [1] TRUE
is_color_invisible(NA)
#> [1] TRUE
is_color_invisible("blue")
#> [1] FALSE
is_color_invisible("#05AE9C")
#> [1] FALSE
if (requireNamespace("grid", quietly = TRUE)) {
identical(inch(1), grid::unit(1, "inch"))
}
#> [1] TRUE