context("test replace_dimension_in_facts")
test_that("replace_dimension_in_facts works", {
st <- replace_dimension_in_facts(st_mrs_age_test, "when", ct_mrs_test$dimension$when, set_type_conformed = TRUE)
expect_equal(
attributes(st$dimension$when),
list(
names = c("when_key", "week_ending_date", "week", "year"),
row.names = integer(0),
class = c("tbl_df", "tbl", "data.frame",
"dimension_table"),
name = "when",
type = c("role", "conformed"),
role_playing = "when_common"
)
)
expect_equal(nrow(st$dimension$when_common), 13)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.