combine: Combine vectors

Description Usage Arguments Examples

View source: R/deprec-combine.R

Description

\Sexpr[results=rd, stage=render]{lifecycle::badge("deprecated")}

combine() is deprecated in favour of vctrs::vec_c(). combine() attempted to automatically guess whether you wanted c() or unlist(), but could fail in surprising ways. We now believe it's better to be explicit.

Usage

1

Arguments

...

Vectors to combine.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
f1 <- factor("a")
f2 <- factor("b")

combine(f1, f2)
# ->
vctrs::vec_c(f1, f1)

combine(list(f1, f2))
# ->
vctrs::vec_c(!!!list(f1, f2))

Example output

Attaching package: 'dplyr'

The following objects are masked from 'package:stats':

    filter, lag

The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union

[1] "a" "b"
Warning messages:
1: In combine_all(args) : Unequal factor levels: coercing to character
2: In combine_all(args) :
  binding character and factor vector, coercing into character vector
3: In combine_all(args) :
  binding character and factor vector, coercing into character vector
[1] a a
Levels: a
[1] "a" "b"
Warning messages:
1: In combine_all(args[[1]]) :
  Unequal factor levels: coercing to character
2: In combine_all(args[[1]]) :
  binding character and factor vector, coercing into character vector
3: In combine_all(args[[1]]) :
  binding character and factor vector, coercing into character vector
[1] a b
Levels: a b

dplyr documentation built on June 19, 2021, 1:07 a.m.