library(Orcs)

Merging multiple data frames in R is anything but straightforward and usually involves confusing loop structures. multiMerge elegantly avoids such bewildering code chunks by invoking Reduce upon a list of data frames. The function also features a set of auxiliary parameters that are passed on to merge. Note that the code is mainly taken from a related blog post in StackOverflow.

## sample data
set.seed(10)
ls_df <- list(data.frame(a = 1:10, b = 1:10),
              data.frame(a = 5:14, c = 11:20),
              data.frame(a = sample(20, 10), d = runif(10)))

## merge data frames in one go
merge(ls_df, by = "a", all = TRUE)


fdetsch/Orcs documentation built on Jan. 9, 2023, 6:14 a.m.