How to join thousands of tibbles at once

I have >1,000 tibbles each of which have two columns named id and value. id contains row identifiers, and value contains numeric values specific to each tibble. I want to merge all tibbles into one large tibble using the id column as row index. This can be accomplished using the command below.

tibble1 %>% 
  full_join(tibble2, by = "id") %>% 
  full_join(tibble3, by = "id") %>% 
  full_join(tibble4, by = "id") %>%
  full_join(tibble5, by = "id") %>%
  ... # repeat to the last tibble

Is there any shorter way to do this?

You should be able to use Reduce() or purrr::reduce():

1 Like

You should also question why you have thousands of tibbles in the first place. There will likely be a way to import those as a list of tibbles.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.