Self Joining in R
问题 Here is a sample tibble: test <- tibble(a = c("dd1","dd2","dd3","dd4","dd5"), name = c("a", "b", "c", "d", "e"), b = c("dd3","dd4","dd1","dd5","dd2")) And I want to add a new column b_name as self-join to test using: dplyr::inner_join(test, test, by = c("a" = "b")) My table is way to large (2.7M rows with 4 columns) and I get the following error: Error: std::bad_alloc Please advise how to do it right / best practice. My final goal is to get the following structure: a name b b_name dd1 a dd3 c