I want to concatenate tibbles,
- there are few common columns
- few columns with same name but different values
- one different column
I have create an example below, can someone please create the desired tibble
Thanks
library(tidyverse)
# common columns in both tibble
x <- c(1, 2, 3)
y <- c(2, 3, 4)
# common column name and different value for each tibble
v <- c(15, 10, 20)
# specific column to tibble
t_a <- c(4, 5, 6)
tbl_a <- tibble(x, y, v, t_a)
# common column name and different value for each tibble
v <- c(7, 11, 13)
# specific column to tibble
t_b<- c(9, 14, 46)
tbl_b <- tibble(x, y, v, t_b)
# concatenate tbl such output looks like this
x <- c(1, 2, 3, 1, 2, 3)
y <- c(2, 3, 4, 2, 3, 4)
v <- c(15, 10, 20, 7, 11, 13)
t <- c(4, 5, 6, 9, 14, 46)
name <- c("a", "a", "a", "b", "b", "b")
# desired output
tbl <- tibble(x, y, v, t, name)