Cast colour vectors and colour palettes to tibbles
Source:R/as_tibble.R
as_tibble.palettes_colour.Rd
as_tibble()
turns an existing colour vector or colour palette into a
so-called tibble, a data frame with class tbl_df
.
Arguments
- x
An object of class
palettes_palette
orpalettes_colour
.- ...
Not used.
Value
A tibble. The output has the following properties:
For objects of class
palettes_colour
: A tibble with columncolour
containing the colour vector.For objects of class
palettes_palette
: A tibble with columnspalette
andcolour
containing palette names and colour vectors.
Examples
x <- pal_colour(c("#663171", "#EA7428", "#0C7156"))
as_tibble(x)
#> # A tibble: 3 × 1
#> colour
#> <colour>
#> 1 • #663171
#> 2 • #EA7428
#> 3 • #0C7156
y <- pal_palette(
Egypt = c("#DD5129", "#0F7BA2", "#43B284", "#FAB255"),
Java = c("#663171", "#CF3A36", "#EA7428", "#E2998A", "#0C7156")
)
as_tibble(y)
#> # A tibble: 9 × 2
#> palette colour
#> <chr> <colour>
#> 1 Egypt • #DD5129
#> 2 Egypt • #0F7BA2
#> 3 Egypt • #43B284
#> 4 Egypt • #FAB255
#> 5 Java • #663171
#> 6 Java • #CF3A36
#> 7 Java • #EA7428
#> 8 Java • #E2998A
#> 9 Java • #0C7156