R Programming

Quickly merge a single column to a large data frame using a named vector

Ryan Benz

The merge function in R is convenient for merging two data frames. However, if your input data frames are large, merge can be very slow. In the case where you just need to merge in a single column, indexing a named vector can be much faster, as shown in the Gist below.