Enhancing a data.frame with a data.table

When you process a dataset that is a Gigabyte or larger in size, you may find that a data.frame is rather inefficient. To address this issue, you can use the enhanced extension of data.framedata.table. In this recipe, we will show how to create a data.table in R.

Getting ready

Download the purchase_view.tab and purchase_order.tab datasets from the following GitHub links, respectively:

How to do it…

Perform the following steps to create a data.table:

  1. First, install and load the data.table package using the following commands:
    > install.packages("data.table")
    > library(data.table) ...

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

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