add_transactions | R Documentation |
Attach summarized transactions to a data frame with exposure-level records.
add_transactions(
.data,
trx_data,
col_pol_num = "pol_num",
col_trx_date = "trx_date",
col_trx_type = "trx_type",
col_trx_amt = "trx_amt"
)
.data |
A data frame with exposure-level records with the class
|
trx_data |
A data frame containing transactions details. This data frame must have columns for policy numbers, transaction dates, transaction types, and transaction amounts. |
col_pol_num |
Name of the column in |
col_trx_date |
Name of the column in |
col_trx_type |
Name of the column in |
col_trx_amt |
Name of the column in |
This function attaches transactions to an exposed_df
object.
Transactions are grouped and summarized such that the number of rows in
the exposed_df
object does not change. Two columns are added to the output
for each transaction type. These columns have names of the pattern
trx_n_{*}
(transaction counts) and trx_amt_{*}
(transaction_amounts).
Transactions are associated with the exposed_df
object by matching
transactions dates with exposure dates ranges found in exposed_df
.
All columns containing dates must be in YYYY-MM-DD format.
An exposed_df
object with two new columns containing transaction
counts and amounts for each transaction type found in trx_data
. The
exposed_df
's trx_types
attributes will be updated to include the new
transaction types found in trx_data.
expose()
, as_exposed_df()
expo <- expose_py(census_dat, "2019-12-31", target_status = "Surrender")
add_transactions(expo, withdrawals)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.