我试图从两个DF中计算累积确诊病例率(即每10000人中的病例数)和按月计算的累计死亡率,并将其绘制成地图。
这是我的DF
到目前为止,我已经尝试过这样做,我想原因是Total_Population不是在clean_df内部,而是在indo_filter_3内部。如何从两个不同的DF (Indo_filter_3 & clean_df)创建一个新的计算字段,然后创建一个叶绿体映射?
new_df <- clean_df %>%
group_by(Sub_District, Month) %>%
summarise(`Cases` = sum(as.numeric(Cases))/Total_Population)
tmap_mode("plot")
tm_shape(new_df)+
tm_fill("Cases_Pop",minimize = TRUE) +
tm_borders(alpha = 0.5) 发布于 2021-08-29 02:08:59
在聚合之前,考虑接合这两个数据帧:
new_df <- clean_df %>%
inner_join(indo_filter_3, by=c("Province", "City", "District", "Sub_District")) %>%
group_by(Sub_District, Month) %>%
summarise(`Cases` = sum(as.numeric(Cases))/Total_Population)https://stackoverflow.com/questions/68968941
复制相似问题