Skip to contents

Reports companies that were not matched in the loanbook

Usage

report_no_matches(loanbook, manually_matched)

Arguments

loanbook

Loanbook data set

manually_matched

Tibble holding the result of the matching process, after the user has manually selected and matched the companies in the loanbook with the tilt data set.

Value

not_matched_companies Tibble holding id and company name of the companies not matched by the tilt data set.

Examples

library(tibble)

loanbook <- tibble(id = 1:2, company_name = letters[id], irrelevant = "xyz")
loanbook
#> # A tibble: 2 × 3
#>      id company_name irrelevant
#>   <int> <chr>        <chr>     
#> 1     1 a            xyz       
#> 2     2 b            xyz       

accepted <- tibble(id = 1:2, accept_match = c(TRUE, FALSE))
accepted
#> # A tibble: 2 × 2
#>      id accept_match
#>   <int> <lgl>       
#> 1     1 TRUE        
#> 2     2 FALSE       

report_no_matches(loanbook, accepted)
#> # A tibble: 1 × 2
#>   company_name    id
#>   <chr>        <int>
#> 1 b                2

# It's rigurous but fails with informative messages:
# The names of crucial columns must be as documented.
try(report_no_matches(loanbook, tibble(ids = 1, accept_match = TRUE)))
#> Error in abort_missing_names(sort(setdiff(expected_names, names(x)))) : 
#>   Must have missing names:
#> `id`

# The type of `accept_match` must be as documented.
try(report_no_matches(loanbook, tibble(id = 1, accept_match = "TRUE")))
#> Error in report_no_matches(loanbook, tibble(id = 1, accept_match = "TRUE")) : 
#>   `manually_matched$accept_match` must be a vector with type <logical>.
#> Instead, it has type <character>.