Once we have selected the facts, dimensions and defined the conditions on the instances, we can execute the query to obtain the result.
Details
As an option, we can indicate if we do not want to unify the facts in the case of having the same grain.
See also
Other query functions:
as_GeoPackage()
,
as_geolayer()
,
filter_dimension()
,
get_layer()
,
get_variable_description()
,
get_variables()
,
select_dimension()
,
select_fact()
,
set_layer()
,
set_variables()
,
star_query()
Examples
sq <- mrs_db |>
star_query() |>
select_dimension(name = "where",
attributes = c("city", "state")) |>
select_dimension(name = "when",
attributes = "year") |>
select_fact(
name = "mrs_age",
measures = "all_deaths",
agg_functions = "MAX"
) |>
select_fact(
name = "mrs_cause",
measures = c("pneumonia_and_influenza_deaths", "all_deaths")
) |>
filter_dimension(name = "when", week <= " 3") |>
filter_dimension(name = "where", city == "Bridgeport")
mrs_db_2 <- mrs_db |>
run_query(sq)