Hi, I have two data frames with columns of different names which I want to append. It's like I'm looking for the by
argument that you get with joins, but can't find an equivalent. Here's what I have right now, is there a more elegant way to do this?
library(tidyverse)
x <- tibble(name = c('Bob', 'Susan', 'Joe'),
height = c(59, 58, 61))
y <- tibble(NAME = c('George', 'Angela', 'Jon'),
HEIGHT = c(55, 63, 53))
# This is a no go...
# x %>% bind_rows(y, by = c('name'='NAME', 'height'='HEIGHT'))
# This works but feels clunky
new_colnames <- c('name', 'height')
colnames(x) <- new_colnames
colnames(y) <- new_colnames
x %>% bind_rows(y)
# A tibble: 6 x 2
name height
<chr> <dbl>
1 Bob 59
2 Susan 58
3 Joe 61
4 George 55
5 Angela 63
6 Jon 53