introduce {gggenomes} | R Documentation |
Introduce non-existing columns
Description
Works like dplyr::mutate()
but without changing existing columns, but only
adding new ones. Useful to add possibly missing columns with default values.
Usage
introduce(.data, ...)
Arguments
.data |
A data frame, data frame extension (e.g. a tibble), or a lazy data frame (e.g. from dbplyr or dtplyr). See Methods, below, for more details. |
... |
< The value can be:
|
Value
a tibble with new columns
Examples
# ensure columns "y" and "z" exist
tibble::tibble(x = 1:3) %>%
introduce(y = "a", z = paste0(y, dplyr::row_number()))
# ensure columns "y" and "z" exist, but do not overwrite "y"
tibble::tibble(x = 1:3, y = c("c", "d", "e")) %>%
introduce(y = "a", z = paste0(y, dplyr::row_number()))
[Package gggenomes version 1.0.0 Index]