multistar_as_flat_table {geomultistar} | R Documentation |
Export a multistar
as a flat table
Description
We can obtain a flat table, implemented using a tibble
, from a multistar
(which can be the result of a query). If it only has one fact table, it is
not necessary to provide its name.
Usage
multistar_as_flat_table(ms, fact = NULL)
## S3 method for class 'multistar'
multistar_as_flat_table(ms, fact = NULL)
Arguments
ms |
A |
fact |
A string, name of the fact. |
Value
A tibble
.
Examples
ft <- ms_mrs |>
multistar_as_flat_table(fact = "mrs_age")
ms <- dimensional_query(ms_mrs) |>
select_dimension(name = "where",
attributes = c("city", "state")) |>
select_dimension(name = "when",
attributes = c("when_happened_year")) |>
select_fact(name = "mrs_age",
measures = c("n_deaths")) |>
select_fact(
name = "mrs_cause",
measures = c("pneumonia_and_influenza_deaths", "other_deaths")
) |>
filter_dimension(name = "when", when_happened_week <= "03") |>
filter_dimension(name = "where", city == "Boston") |>
run_query()
ft <- ms |>
multistar_as_flat_table()
[Package geomultistar version 1.2.2 Index]