Unite multiple columns in an ir
object into one by pasting strings together
Source: R/tidyverse.R
unite.ir.Rd
Unite multiple columns in an ir
object into one by pasting strings together
Arguments
- data
An object of class
ir
.- col
The name of the new column, as a string or symbol.
This argument is passed by expression and supports quasiquotation (you can unquote strings and symbols). The name is captured from the expression with
rlang::ensym()
(note that this kind of interface where symbols do not represent actual objects is now discouraged in the tidyverse; we support it here for backward compatibility).- ...
<
tidy-select
> Columns to unite- sep
Separator to use between values.
- remove
If
TRUE
, remove input columns from output data frame.- na.rm
If
TRUE
, missing values will be remove prior to uniting each value.
Value
.data
with united columns. If the spectra
column is
dropped or invalidated (see ir_new_ir()
), the ir
class is dropped, else
the object is of class ir
.
See also
Other tidyverse:
arrange.ir()
,
distinct.ir()
,
extract.ir()
,
filter-joins
,
filter.ir()
,
group_by
,
mutate-joins
,
mutate
,
nest
,
pivot_longer.ir()
,
pivot_wider.ir()
,
rename
,
rowwise.ir()
,
select.ir()
,
separate.ir()
,
separate_rows.ir()
,
slice
,
summarize
Examples
## unite
ir_sample_data %>%
tidyr::separate(
"id_sample", c("a", "b", "c")
) %>%
tidyr::unite(id_sample, a, b, c)
#> # A tibble: 58 × 7
#> id_measurement col sample_type sample_comment klason_lignin holocellulose
#> * <int> <chr> <chr> <chr> [1] [1]
#> 1 1 GN_11_… needles Abies Firma M… 0.360 0.308
#> 2 2 GN_11_… needles Cupressocypar… 0.339 0.250
#> 3 3 GN_11_… needles Juniperus chi… 0.268 0.336
#> 4 4 GN_11_… needles Metasequoia g… 0.350 0.184
#> 5 5 GN_11_… needles Pinus strobus… 0.331 0.309
#> 6 6 GN_11_… needles Pseudolarix a… 0.279 0.335
#> 7 7 GN_11_… needles Sequoia sempe… 0.330 0.241
#> 8 8 GN_11_… needles Taxodium dist… 0.357 0.125
#> 9 9 GN_11_… needles Thuja occiden… 0.369 0.252
#> 10 10 GN_11_… needles Tsuga carolin… 0.289 0.349
#> # … with 48 more rows, and 1 more variable: spectra <named list>