出生队列接种率数据预处理
gnldet <- readxl::read_xlsx('/mnt/c/Users/xuefliang/Downloads/gnldet_jzl.xlsx', sheet = 1, skip = 2) %>%
slice(-1) %>%
fill(区划名称, 区划编码, 疫苗, .direction = "down") %>%
rename(jc = `...4`) %>%
{
new_names <- c()
for (i in 1:18) {
new_names <- c(new_names, paste0(i, "岁接种数"), paste0(i, "岁接种率"))
}
old_names <- colnames(.)
colnames(.)[5:length(old_names)] <- new_names
.
} %>%
mutate(across(contains("率"), ~ as.numeric(str_replace_all(., "%", ""))),
across(contains("数"), ~ as.numeric(.))) %>%
filter(疫苗 != '总人数')
gnldet %>%
filter(疫苗=='乙肝疫苗' & jc=='1.0') %>%
select(区划名称,区划编码,疫苗,jc,`1岁接种率`) %>%
mutate(`1岁接种率大于90` = `1岁接种率` > 90) %>%
filter(`1岁接种率大于90`==FALSE) ->test
评论
发表评论