Learning Objectives:
- How to install
data.table
package - How to load the
data.table
package - Assessing the structure of a
data.table
object- Printing
data.table
objects - Use
head()
andtail()
to view the first (and last) five rows - Use
View()
to view an entiredata.table
object - Use
str()
to view the structure ofdata.table
object - Use
tables()
to show all loadeddata.table
objects
- Printing
- Sorting and ordering rows using
setorder()
andorder()
- How to remove information:
- Selecting rows:
DT[i,j, by]
- Selecting rows based on a condition satisfied by column(s)
- Selecting rows using helper functions:
%like%
and%between%
- Selecting columns:
DT[i, j, by]
- Renaming columns
- Selecting rows:
- How to add information:
- Making new columns while preserving the existing ones using
:=
- Making new columns while dropping existing ones
- Making new columns while preserving the existing ones using
- How to reduce information:
- Summarising rows:
DT[i, j, by]
- Grouping by one or more variables
- Summarising rows:
- How to combine information:
- Joining two
data.table
objects usingmerge()
anddata.table
syntax - Full join; Inner join; Left join; Right join
- Joining two