Closed maurolepore closed 4 months ago
This PR adds example_data_factory() from tiltIndicator, and uses it to create the new example_financial().
example_data_factory()
example_financial()
The goal is to make it easy to create example datasets succinctly, and without mentioning brittle columns names.
example_financial() #> # A tibble: 1 × 8 #> bank_id amount_total company_name emission_profile benchmark #> <chr> <dbl> <chr> <chr> <chr> #> 1 a 10 b medium c #> # ℹ 3 more variables: equal_weight_finance <dbl>, worst_case_finance <dbl>, #> # best_case_finance <dbl> # Add rows example_financial(bank_id = 1:2) #> # A tibble: 2 × 8 #> bank_id amount_total company_name emission_profile benchmark #> <int> <dbl> <chr> <chr> <chr> #> 1 1 10 b medium c #> 2 2 10 b medium c #> # ℹ 3 more variables: equal_weight_finance <dbl>, worst_case_finance <dbl>, #> # best_case_finance <dbl> # Add columns example_financial(new = 1) #> # A tibble: 1 × 9 #> new bank_id amount_total company_name emission_profile benchmark #> <dbl> <chr> <dbl> <chr> <chr> <chr> #> 1 1 a 10 b medium c #> # ℹ 3 more variables: equal_weight_finance <dbl>, worst_case_finance <dbl>, #> # best_case_finance <dbl> # Remove columns example_financial(bank_id = NULL) #> # A tibble: 1 × 8 #> bank_id amount_total company_name emission_profile benchmark #> <chr> <dbl> <chr> <chr> <chr> #> 1 a 10 b medium c #> # ℹ 3 more variables: equal_weight_finance <dbl>, worst_case_finance <dbl>, #> # best_case_finance <dbl> # Pass column names stored in vectors id <- "bank_id" example_financial(!!id := "c") #> # A tibble: 1 × 8 #> bank_id amount_total company_name emission_profile benchmark #> <chr> <dbl> <chr> <chr> <chr> #> 1 c 10 b medium c #> # ℹ 3 more variables: equal_weight_finance <dbl>, worst_case_finance <dbl>, #> # best_case_finance <dbl>
TODO
EXCEPTIONS
This PR adds
example_data_factory()
from tiltIndicator, and uses it to create the newexample_financial()
.The goal is to make it easy to create example datasets succinctly, and without mentioning brittle columns names.
TODO
EXCEPTIONS