Description Usage Arguments Value Examples
View source: R/separate-unite.R
These functions work like tidyr::separate()
and tidyr::unite()
,
combining information from multiple columns into single column. You
can also create and separate columns using dplyr::mutate()
and
the constructors (geo_xy()
, geo_segment()
, and geo_rect()
).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | unite_xy(data, col, x, y, remove = TRUE)
separate_xy(data, col, into = c("x", "y"), remove = TRUE)
unite_xyz(data, col, x, y, z, remove = TRUE)
separate_xyz(data, col, into = c("x", "y", "z"), remove = TRUE)
unite_segment(data, col, x0, y0, x1, y1, remove = TRUE)
separate_segment(data, col, into = c("x0", "y0", "x1", "y1"), remove = TRUE)
unite_rect(data, col, xmin, ymin, xmax, ymax, remove = TRUE)
separate_rect(
data,
col,
into = c("xmin", "ymin", "xmax", "ymax"),
remove = TRUE
)
|
data |
A |
col |
A column name for the united object |
x |
x, y, and z coordinate vectors |
y |
x, y, and z coordinate vectors |
remove |
Use |
into |
Column names for the separated vectors |
z |
x, y, and z coordinate vectors |
x0 |
Values for the start and end coordinates. |
y0 |
Values for the start and end coordinates. |
x1 |
Values for the start and end coordinates. |
y1 |
Values for the start and end coordinates. |
xmin |
Border values, recycled to a common
length using |
ymin |
Border values, recycled to a common
length using |
xmax |
Border values, recycled to a common
length using |
ymax |
Border values, recycled to a common
length using |
data
, with new column(s) col
/into
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | tbl <- tibble(a = 1, b = 2, c = 3, d = 4)
(united <- unite_xy(tbl, "xy", a, b))
separate_xy(united, xy)
(united <- unite_xyz(tbl, "xyz", a, b, c))
separate_xyz(united, xyz)
(united <- unite_rect(tbl, "rect", a, b, c, d))
separate_rect(united, rect)
# need to modify geo_segment() constructor!
# (united <- unite_segment(tbl, "seg", a, b, c, d))
# separate_segment(united, seg)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.