- library(tidyverse)
- library(lubridate)
- a <- read.csv("da02.csv", header = TRUE, stringsAsFactors = FALSE) %>%
- tbl_df() %>%
- mutate_at(vars(datetime, ipodate), .funs = as_date)
- a %>%
- filter(top5 == 1) %>%
- group_by(datetime) %>%
- summarise(W_loan_depo_ratio_n = weighted.mean(loan_depo_ratio_n, total_deposit_n, na.rm = TRUE),
- W_npl_ratio_n = weighted.mean(npl_ratio_n, total_deposit_n, na.rm = TRUE))
注:我第二个变量的权重选错了,请你自己更正一下。


雷达卡




京公网安备 11010802022788号







