Description Usage Arguments Details Value Author(s) Examples
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
.
1 | rf2score(rf_df, score_config_list)
|
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. |
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.
a tibble
with every risk factor score
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## 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)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.