Two ways to subsetting rows in a data.table
Q: In the flights dataset, subsetting all the rows in which the planes take off from LGA and land in TPA.
- By
i
flights[origin == "LGA" & dest == "TPA", ]
- By
keysetkeyv(flights, c("origin", "dest")) flights[.("LGA", "TPA"), ]

浙公网安备 33010602011771号