# NOT RUN {
library(dplyr)
dm_nyc_filtered <-
cdm_nycflights13() %>%
cdm_filter(airports, name == "John F Kennedy Intl")
tbl(dm_nyc_filtered, "flights")
dm_nyc_filtered[["planes"]]
dm_nyc_filtered$airlines
cdm_nycflights13() %>%
cdm_filter(airports, name == "John F Kennedy Intl") %>%
cdm_apply_filters()
# If you want to only keep those rows in the parent tables
# whose primary key values appear as foreign key values in
# `flights`, you can set a `TRUE` filter in `flights`:
cdm_nycflights13() %>%
cdm_filter(flights, 1 == 1) %>%
cdm_apply_filters() %>%
cdm_nrow()
# note, that in this example the only affected table is
# `airports` (since the departure airports in `flights` are
# only the 3 NYC ones).
cdm_nycflights13() %>%
cdm_filter(flights, month == 3) %>%
cdm_apply_filters()
library(dplyr)
cdm_nycflights13() %>%
cdm_filter(planes, engine %in% c("Reciprocating", "4 Cycle")) %>%
compute()
# }
Run the code above in your browser using DataLab