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
key
setkeyv(flights, c("origin", "dest")) flights[.("LGA", "TPA"), ]
Q: In the flights
dataset, subsetting all the rows in which the planes take off from LGA
and land in TPA
.
i
flights[origin == "LGA" & dest == "TPA", ]
key
setkeyv(flights, c("origin", "dest"))
flights[.("LGA", "TPA"), ]