Convert colors (R colors and hex colors) into packed colors (integer values containing RGBA bytes)

str_cols_to_packed_cols(colors)

Arguments

colors

character vector of R color names and hex colors e.g. c('red', 'white', NA, 'transparent', '#12345678')

Value

Integer vector. Each integer value contains a packed color i.e. RGBA bytes.

Examples

str_cols_to_packed_cols(c('red', 'white', 'blue', NA, 'transparent'))
#> [1] -16776961        -1    -65536  16777215  16777215