O'Reilly logo

Learning Shiny by Hernán G. Resnizky

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The data.table package

data.table is a revolutionary package in R because it uses a new approach to data processing that results in a much faster execution time. However, it has a drawback that it uses a syntax that, although easy to understand, differs considerably from the normal R syntax.

Mainly, every operation in a data table is done inside brackets that normally refer to dimensions in arrays or data frames:

data.table.object[operations over rows, operations over columns, by]

In the preceding code snippet, by is optional. The columns can be selected either by name or column index. However, for this last option, the with=FALSE argument has to be added:

> data(iris)
> iris <- data.table(iris)
> iris[,2,with=F]
Sepal.Width
1: 3.5
2: 3.0
3: 3.2 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required