Learn R Programming

starschemar (version 1.1.0)

multistar_as_flat_table: 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, name = NULL)

# S3 method for multistar multistar_as_flat_table(ms, name = NULL)

Arguments

ms

A multistar object.

name

A string, name of the fact.

Value

A tibble.

See Also

Other results export functions: constellation_as_multistar(), constellation_as_tibble_list(), star_schema_as_flat_table(), star_schema_as_multistar(), star_schema_as_tibble_list()

Examples

Run this code
# NOT RUN {
library(tidyr)

ft <- ms_mrs %>%
  multistar_as_flat_table(name = "mrs_age")

ms <- dimensional_query(ms_mrs) %>%
  select_dimension(name = "where",
                  attributes = c("city", "state")) %>%
  select_dimension(name = "when",
                  attributes = c("year")) %>%
  select_fact(
    name = "mrs_age",
    measures = c("deaths")
  ) %>%
  select_fact(name = "mrs_cause",
             measures = c("pneumonia_and_influenza_deaths", "other_deaths")) %>%
  filter_dimension(name = "when", week <= "03") %>%
  filter_dimension(name = "where", city == "Boston") %>%
  run_query()

ft <- ms %>%
  multistar_as_flat_table()

# }

Run the code above in your browser using DataLab