Merge multiple data frames with `multiMerge`"


Merging multiple data frames in R is anything but straightforward and usually involves confusing loop structures. multiMerge elegantly avoids such bewildering code chunks by envoking 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
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)

Try the Orcs package in your browser

Any scripts or data that you put into this service are public.

Orcs documentation built on May 2, 2019, 2:37 a.m.