The input risk factors should be a data.frame or a tibble, which contains all raw risk factors value and should not contians user_id and others. The score_config_list should be a list, *_values should be in front of *_scores.

rf2score(rf_df, score_config_list)

Arguments

rf_df

Risk factors data frame(exclude user_id)

score_config_list

A List contains all riskFactors value and score index, read from .RDS file.

Value

a tibble with every risk factor score

Details

You should carefull about the risk facotrs rf_df names and the score_config_list names. *_values/*_scores and the risk factors names should be the same.

Examples

# NOT RUN {
require(dplyr)
score_config_list <- readRDS("result/score_config_list.RDS")
pj_rf <- readr::read_csv("data/pingjia/pingjia_result.csv",col_names = FALSE)
nameTmp <- c("acc_count_phk","act_radius","dec_count_phk","high_curv_tr","holiday_tr",
"interstate_r","lane_change_phk","late_night_tr","long_tr","main_act_prov"
, "mileage","speeding_lvl", "speeding_phk", "trip_dis_e", "turn_count_phk","user_id")
names(pj_rf) <- nameTmp

risk_factor_names <- setdiff(nameTmp, c("user_id","main_act_prov"))
pj_rf <- pj_rf %>% select(!!risk_factor_names)

rf2score(pj_rf, score_config_list)
# }