Merge investments with loans by dates, merge investment with bridges by date.
Source:R/ffp_investloan_roster.R
ffp_hfid_invest_loan_or_bridge_linker.RdImplements 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.
See also
Used by vignette(s) ffv_invest_loan_bridge. Related issue(s):
PrjThaiHFID-#32.
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: 14,859 × 3
#> # Groups: hhid_Num [492]
#> hhid_Num hh_inv_ctr bridge_id
#> <int> <int> <int>
#> 1 1003 1 4192
#> 2 1003 1 4192
#> 3 1031 3 13374
#> 4 1099 2 13379
#> 5 1099 3 13379
#> 6 1113 1 17749
#> 7 1113 1 17750
#> 8 1113 1 13380
#> 9 1113 1 13380
#> 10 1113 1 8318
#> # ℹ 14,849 more rows
#>
#> $tstm_roster_invest_loan_linker
#> # A tibble: 4,120 × 3
#> # Groups: hhid_Num [634]
#> hhid_Num hh_inv_ctr hh_loan_id_nd
#> <int> <int> <int>
#> 1 1003 1 1
#> 2 1003 1 2
#> 3 1031 1 15
#> 4 1031 3 23
#> 5 1078 1 40
#> 6 1078 2 40
#> 7 1090 1 55
#> 8 1099 1 75
#> 9 1099 2 75
#> 10 1099 2 76
#> # ℹ 4,110 more rows
#>