Book Image

Learning Shiny

By : Hernan Resnizky
Book Image

Learning Shiny

By: Hernan Resnizky

Overview of this book

Table of Contents (19 chapters)
Learning Shiny
Credits
About the Author
Acknowledgements
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
1
Introducing R, RStudio, and Shiny
Index

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
4: 3.1
5: 3.6
---
146: 3.0
147: 2.5
148: 3.0
149: 3.4
150: 3.0

Data table objects are also printed differently. Data table also has the functionality of adding new variables to the object without any need to rename it using the := operator...