Merging large datasets with a data.table

In previous recipes, we demonstrated how to manipulate and aggregate data with a data.table. In addition to performing data manipulation on a single table, we often need to import additional features or correlate data from other data sources. Therefore, we can join two or more tables into one. In this recipe, we introduce some methods that we can use to merge two data.table.

Getting ready

Ensure that you completed the Enhancing a data.frame with a data.table recipe to load purchase_view.tab and purchase_order.tab as both data.frame and data.table into your R environment.

How to do it…

Perform the following steps to merge two data.table:

  1. First, we generate a product.dt data table by calculating the number of ...

Get R for Data Science Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.