如何将向量作为变量添加到 tibble(列)

How to add vector to tibble as a variable (column)

我有向量vec<-1,2,3。我的标题看起来像:

first | second 
1     |1
1     |1
1     |1

现在我需要将向量 vec 作为变量(列)添加到我现有的 tibble 中,这样 tibble 应该如下所示:

first | second | third
1     |1          |1
1     |1          |2
1     |1          |3
library(dplyr)

tib <- tibble(first  = rep(1, 3),
       second = rep(1, 3)) 
vec <- c(1,2,3)

tib %>%
  mutate(third = vec)