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
:
- First, we generate a
product.dt
data table by calculating the number of ...
Get R for Data Science Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.