Skip to contents

Implements step 2 of https://github.com/FanWangEcon/PrjThaiHFID/issues/22 part 2, generate tstm_roster_invest_overlap_bridges.csv and tstm_roster_invest_overlap_loan.csv. _notes/issues/issues_20240217_roster_invest_bridge.md

Usage

ffp_hfid_invest_loan_or_bridge_linker(
  df_roster_invest_loan_bridge,
  it_gap_LBL_IL_min = -6,
  it_gap_LBL_IL_back_add = 0,
  verbose = FALSE,
  verbose_detail = FALSE,
  it_verbose_detail_nrow = 100
)

Arguments

df_roster_invest_loan_bridge

A data frame containing the roster of investments, loans, and bridges.

it_gap_LBL_IL_min

The minimum gap between the left start month of bridge/loan and the investment.

it_gap_LBL_IL_back_add

The additional gap between the left start month of bridge/loan and the investment.

verbose

A logical value indicating whether to print verbose output.

verbose_detail

A logical value indicating whether to print detailed verbose output.

it_verbose_detail_nrow

The number of rows to print for detailed verbose output.

Value

A list containing two data frames: tstm_roster_invest_bridge_linker and tstm_roster_invest_loan_linker.

Author

Fan Wang, http://fanwangecon.github.io

Examples

df_invdates_uniq <- PrjThaiHFID::tstm_invdates_uniq
df_loans_bridges_type <- PrjThaiHFID::tstm_loans_bridges_type
df_loans_pn_nd <- PrjThaiHFID::tstm_loans_pn_nd
ls_return_p1 <- ffp_hfid_invest_loan_bridge_roster(df_invdates_uniq, df_loans_bridges_type, df_loans_pn_nd)
#> Adding missing grouping variables: `br_type`, `br_type_id`
df_roster_invest_loan_bridge <- ls_return_p1$tstm_roster_invest_loan_bridge
ls_return_p2 <- ffp_hfid_invest_loan_or_bridge_linker(df_roster_invest_loan_bridge)
print(ls_return_p2)
#> [[1]]
#> NULL
#> 
#> [[2]]
#> NULL
#> 
#> $tstm_roster_invest_bridge_linker
#> # A tibble: 24,996 × 3
#> # Groups:   hhid_Num [532]
#>    hhid_Num hh_inv_ctr bridge_id
#>       <dbl>      <int>     <int>
#>  1    70203          2      4179
#>  2    70203          2      4180
#>  3    70203          2      4179
#>  4    70203          2      4180
#>  5    70203          2     10935
#>  6    70203          2     10935
#>  7    70203          2     10935
#>  8    70203          2     10935
#>  9    70203          2       695
#> 10    70203          2      2296
#> # ℹ 24,986 more rows
#> 
#> $tstm_roster_invest_loan_linker
#> # A tibble: 5,080 × 3
#> # Groups:   hhid_Num [651]
#>    hhid_Num hh_inv_ctr hh_loan_id_nd
#>       <dbl>      <int>         <int>
#>  1    70203          2             8
#>  2    70203          2             9
#>  3    70203          2            10
#>  4    70203          3            18
#>  5    70203          4            18
#>  6    70203          4            19
#>  7    70204          1            24
#>  8    70204          2            26
#>  9    70204          2            27
#> 10    70204          3            32
#> # ℹ 5,070 more rows
#>