05-GlobalDietaryR包高级-疾病与营养素交互地图
GlobalDietaryR包完全教程系列 - 第五章
⏱️ 预计阅读时间: 35分钟
前置章节: 第1-4章
难度等级: ⭐⭐⭐ 高级
本章目标
学完本章后,你将能够:
✅ 理解疾病与营养素的交互关系
✅ 创建健康相关营养素的专题地图
✅ 分析保护性食物与风险食物的全球分布
✅ 针对特定健康问题进行营养素对比
✅ 生成公共卫生决策支持的可视化报告
术语速查
| 术语 | 英文 | 解释 |
|---|---|---|
| 保护性食物 | Protective Foods | 富含有益营养素,有助于预防疾病的食物 |
| 风险食物 | Risk Foods | 含有有害物质,与疾病风险增加相关的食物 |
| 营养素交互 | Nutrient Interaction | 不同营养素之间的相互作用与影响 |
| 特定健康地图 | Health-Specific Maps | 针对特定疾病或健康状况的营养素地图 |
| 食物-疾病关联 | Food-Disease Association | 特定食物摄入与疾病发生率的关联关系 |
目录
快速开始
创建健康相关营养素地图 - 30秒快速体验
library(GlobalDietaryR)
library(ggplot2)
library(dplyr)
library(tidyr)
library(maps)
library(patchwork)
library(RColorBrewer)
setwd('/Users/yuzheng/Documents/GDD数据库/文档')
dta3 <- readRDS('gdd数据/gdd_country_processed.rds')
# 筛选2018年全年龄数据
dtas_all <- gdd_filter(dta3, year==2018, age=='All ages')
# 创建保护性食物地图
protective_foods <- c("Fruits", "Non-starchy vegetables", "Whole grains",
"Beans and legumes", "Nuts and seeds", "Total seafoods")
map <- plot_multi_world_map(
data = dtas_all %>% filter(nutrition %in% protective_foods),
nutrition_filter = protective_foods,
value_col = "median",
color_scheme = "RdYlGn",
continuous_scale = FALSE,
n_breaks = 5,
ncol = 3,
nrow = 2,
title = "Global Protective Foods Intake - Health-Promoting Foods"
)
map
✅ 输出效果:
- 展示: 6种保护性食物的全球分布
- 配色: RdYlGn (红→黄→绿,绿色=健康)
- 布局: 3×2网格 = 6个世界地图
- 用途: 公共卫生政策制定

基础概念
营养素与疾病的关系
全球疾病负担研究(GBD)已证实,饮食是影响疾病发生的重要可修饰因素。不同营养素与疾病的关系分类:
| 分类 | 营养素示例 | 相关疾病 | 作用机制 |
|---|---|---|---|
| 保护性 | 纤维、钾、镁 | 心血管病、糖尿病 | 抗炎、降血压 |
| 中性 | 某些维生素 | 无特异关联 | 辅助代谢 |
| 风险 | 添加糖、加工肉 | 心血管病、癌症 | 促炎、氧化应激 |
8种健康主题地图
GlobalDietaryR包提供按健康主题分类的营养素地图:
- 保护性食物 - 预防性营养素组合
- 风险食物 - 与疾病风险相关的食物
- 肠道健康 - 纤维与益生元
- 心血管健康 - 钾、镁、不饱和脂肪
- 脑健康 - B族维生素与欧米伽3
- 免疫系统 - 维生素C、D、锌
- 骨骼健康 - 钙、镁、维生素D
- 代谢健康 - 碘、铬等微量元素
健康主题地图
地图1: 保护性食物

说明: 3600×3000 | 1.4MB | Reds | 4种风险食物
地图2: 肠道健康营养素

说明: 4200×3000 | 1.3MB | BuGn | 纤维、益生元
地图3: 心血管健康营养素

说明: 4200×3000 | 1.3MB | YlOrRd | ❤️ 钾、镁、欧米伽3
地图4: 脑健康营养素

说明: 4200×3000 | 1.1MB | Purples | B族维生素、欧米伽3
地图5: 免疫系统营养素

说明: 4200×3000 | 1.3MB | OrRd | ️ 维C、D、锌
地图6: 骨骼健康营养素

说明: 3600×3000 | 1.1MB | Blues | 钙、镁、维D
地图7: 代谢健康营养素

说明: 3600×3000 | 429KB | PuBu | 碘、铬等微量元素
保护性vs风险食物
对比分析
# 对比保护性与风险食物
protective <- c("Fruits", "Vegetables", "Whole grains", "Legumes")
risk_foods <- c("Processed meats", "Sugar-sweetened beverages", "Refined grains")
# 创建两行对比地图
map_protective <- plot_multi_world_map(
data = dtas_all %>% filter(nutrition %in% protective),
nutrition_filter = protective,
color_scheme = "Greens",
ncol = 2, nrow = 2,
title = "保护性食物全球分布"
)
map_risk <- plot_multi_world_map(
data = dtas_all %>% filter(nutrition %in% risk_foods),
nutrition_filter = risk_foods,
color_scheme = "Reds",
ncol = 2, nrow = 2,
title = "风险食物全球分布"
)
# 合并为一个对比图
combined <- map_protective / map_risk
ggsave("protective_vs_risk.png", combined, width=14, height=14, dpi=300)
cat("✅ 保护性与风险食物对比地图已生成\n")
关键发现
基于全球数据的分析:
| 特征 | 保护性食物 | 风险食物 |
|---|---|---|
| 高摄入地区 | 欧洲、东亚 | 北美、大洋洲 |
| 低摄入地区 | 撒哈拉以南非洲 | 低收入国家 |
| 健康效益 | 降低疾病风险 | 增加疾病负担 |
| 成本因素 | 通常更贵 | 价格低廉 |
特定疾病的营养对策
策略1: 心血管疾病预防
# 心血管健康营养素组合
cardio_nutrients <- c("Total protein", "Potassium", "Magnesium",
"Monounsaturated fatty acids", "Plant omega-3 fat")
cardio_map <- plot_multi_world_map(
data = dtas_all %>% filter(nutrition %in% cardio_nutrients),
nutrition_filter = cardio_nutrients,
color_scheme = "YlOrRd",
ncol = 3, nrow = 2,
title = "全球心血管健康营养素分布"
)
# 识别高风险区域(营养不足)
cat("✅ 心血管健康营养素地图已生成\n")
策略2: 糖尿病管理
# 糖尿病管理相关营养素
diabetes_nutrients <- c("Dietary fiber", "Whole grains",
"Non-starchy vegetables", "Nuts and seeds")
diabetes_map <- plot_multi_world_map(
data = dtas_all %>% filter(nutrition %in% diabetes_nutrients),
nutrition_filter = diabetes_nutrients,
color_scheme = "BuGn",
ncol = 2, nrow = 2,
title = "全球糖尿病相关营养素分布"
)
cat("✅ 糖尿病管理营养素地图已生成\n")
策略3: 骨骼健康促进
# 骨骼健康营养素
bone_nutrients <- c("Calcium", "Vitamin D", "Magnesium")
bone_map <- plot_multi_world_map(
data = dtas_all %>% filter(nutrition %in% bone_nutrients),
nutrition_filter = bone_nutrients,
color_scheme = "Blues",
ncol = 2, nrow = 2,
title = "全球骨骼健康营养素分布"
)
cat("✅ 骨骼健康营养素地图已生成\n")
个性化营养分析
按性别分析
# 性别特异性营养需求
# 女性需要更多铁质
female_nutrients <- c("Iron", "Calcium", "Vitamin B9 (Folate)")
dtas_female <- gdd_filter(dta3, year==2018, age=='All ages', sex=='Female')
female_map <- plot_multi_world_map(
data = dtas_female %>% filter(nutrition %in% female_nutrients),
nutrition_filter = female_nutrients,
color_scheme = "PuRd",
ncol = 2, nrow = 2,
title = "女性重点营养素全球分布"
)
cat("✅ 女性营养地图已生成\n")
按年龄组分析
# 儿童关键营养素
child_nutrients <- c("Calcium", "Iron", "Vitamin D", "Protein")
dtas_children <- gdd_filter(dta3, year==2018, age=='age5-9', sex=='Both')
if(nrow(dtas_children) > 0) {
child_map <- plot_multi_world_map(
data = dtas_children %>% filter(nutrition %in% child_nutrients),
nutrition_filter = child_nutrients,
color_scheme = "Set3",
ncol = 2, nrow = 2,
title = "儿童关键营养素全球分布"
)
cat("✅ 儿童营养地图已生成\n")
}
高级技巧
技巧1: 创建健康评分地图
# 计算营养素健康评分
calculate_health_score <- function(data, nutrients) {
data %>%
filter(nutrition %in% nutrients) %>%
group_by(location) %>%
summarise(
health_score = mean(median, na.rm = TRUE),
.groups = 'drop'
)
}
# 应用于数据
health_scores <- calculate_health_score(
dtas_all,
c("Fruits", "Vegetables", "Whole grains", "Legumes")
)
cat("✅ 健康评分计算完成\n")
技巧2: 营养不足检测
# 识别营养不足的国家
identify_deficiencies <- function(data, nutrient, threshold = 50) {
deficient_countries <- data %>%
filter(nutrition == nutrient, median < threshold) %>%
pull(location) %>%
unique()
cat(sprintf("%s 摄入不足的国家(%d个):\n", nutrient, length(deficient_countries)))
print(deficient_countries)
}
identify_deficiencies(dtas_all, "Fruits", threshold = 100)
技巧3: 区域营养差异分析
# 计算区域营养差异
regional_variance <- function(data) {
data %>%
group_by(nutrition) %>%
summarise(
mean_intake = mean(median, na.rm = TRUE),
sd_intake = sd(median, na.rm = TRUE),
cv = sd_intake / mean_intake, # 变异系数
.groups = 'drop'
) %>%
arrange(desc(cv))
}
regional_diff <- regional_variance(dtas_all)
cat("✅ 区域差异分析完成\n")
⚠️ 常见问题
Q1: 如何选择特定健康主题的营养素?
A: 使用预定义的营养素组合:
# 健康主题营养素字典
health_themes <- list(
cardiac = c("Potassium", "Magnesium", "Fiber"),
metabolic = c("Chromium", "Magnesium", "Zinc"),
bone = c("Calcium", "Vitamin D", "Magnesium"),
immune = c("Vitamin C", "Zinc", "Selenium")
)
# 使用特定主题
selected_nutrients <- health_themes[["cardiac"]]
Q2: 如何比较两个地区的营养差异?
A: 使用地区筛选与对比:
# 地区对比
dtas_developed <- dtas_all %>%
filter(location %in% c("United States", "Germany", "Japan"))
dtas_developing <- dtas_all %>%
filter(location %in% c("Nigeria", "Bangladesh", "Ethiopia"))
comparison <- data.frame(
developed = mean(dtas_developed$median),
developing = mean(dtas_developing$median)
)
Q3: 如何解释健康评分的含义?
A: 基于WHO推荐值:
# WHO推荐摄入量参考
who_recommendations <- data.frame(
nutrient = c("Fruits", "Vegetables", "Whole grains"),
who_target = c(400, 400, 0.5 * total_energy)
)
# 计算达标率
compliance_rate <- (observed_intake / who_target) * 100
本章小结
核心知识点
- ✅ 疾病与营养素存在复杂的因果关系
- ✅ 不同健康状况需要针对性的营养干预
- ✅ 全球营养差异反映了经济发展与健康不平等
- ✅ 个性化营养地图支持精准公共卫生决策
实践建议
- 从单一健康主题开始分析
- 结合地区与性别因素进行深度分析
- 利用地图识别干预优先地区
- 制定基于数据的营养政策
下期预告
第六章: 营养与社会经济因素的关联
探索收入水平、教育程度、城市化对营养摄入的影响。我们将:
- 分析社会经济与营养摄入的关联
- 创建社会经济分层地图
- 识别营养不平等的驱动因素
- 设计针对性的干预策略
敬请期待!
完整代码
# ===== GlobalDietaryR 第五章完整代码 =====
# 主题: 疾病与营养素交互地图
# 时间: 2025-11-12
# ===== Step 1: 环境设置 =====
library(GlobalDietaryR)
library(ggplot2)
library(dplyr)
library(tidyr)
library(maps)
library(patchwork)
library(RColorBrewer)
setwd('/Users/yuzheng/Documents/GDD数据库/文档')
# ===== Step 2: 数据加载 =====
dta3 <- readRDS('gdd数据/gdd_country_processed.rds')
dtas_all <- gdd_filter(dta3, year==2018, age=='All ages')
cat("✅ 数据已加载: ", nrow(dtas_all), "行\n")
cat("✅ 营养素:", length(unique(dtas_all$nutrition)), "个\n")
cat("✅ 国家:", length(unique(dtas_all$location)), "个\n\n")
# ===== Step 3: 创建健康主题地图 =====
output_dir <- 'chapter5_maps'
if (!dir.exists(output_dir)) dir.create(output_dir)
# 地图1: 保护性食物
cat("生成地图1: 保护性食物...\n")
protective_foods <- c("Fruits", "Non-starchy vegetables", "Whole grains",
"Beans and legumes", "Nuts and seeds", "Total seafoods")
p1 <- plot_multi_world_map(
data = dtas_all %>% filter(nutrition %in% protective_foods),
nutrition_filter = protective_foods,
value_col = "median",
color_scheme = "RdYlGn",
continuous_scale = FALSE,
n_breaks = 5,
ncol = 3,
nrow = 2,
title = "Global Protective Foods Intake"
)
ggsave(file.path(output_dir, "01_protective_foods.png"),
plot = p1, width = 14, height = 10, dpi = 300)
cat("✅ 地图1已保存\n\n")
# 地图2: 风险食物
cat("生成地图2: 风险食物...\n")
risk_foods <- c("Total processed meats", "Sugar-sweetened beverages",
"Added sugars", "Refined grains")
p2 <- plot_multi_world_map(
data = dtas_all %>% filter(nutrition %in% risk_foods),
nutrition_filter = risk_foods,
value_col = "median",
color_scheme = "Reds",
continuous_scale = FALSE,
n_breaks = 5,
ncol = 2,
nrow = 2,
title = "Global Risk Foods Intake"
)
ggsave(file.path(output_dir, "02_risk_foods.png"),
plot = p2, width = 12, height = 10, dpi = 300)
cat("✅ 地图2已保存\n\n")
# 地图3-8: 按健康主题生成
themes <- list(
gut = c("Dietary fiber", "Beans and legumes", "Whole grains",
"Non-starchy vegetables", "Fruits"),
cardio = c("Total protein", "Potassium", "Magnesium",
"Monounsaturated fatty acids", "Plant omega-3 fat"),
brain = c("Vitamin B12", "Vitamin B9 (Folate)", "Total seafoods",
"Nuts and seeds"),
immune = c("Vitamin C", "Vitamin D", "Zinc", "Iron", "Selenium"),
bone = c("Calcium", "Vitamin D", "Magnesium"),
metabolism = c("Iodine")
)
color_schemes <- c("BuGn", "YlOrRd", "Purples", "OrRd", "Blues", "PuBu")
titles <- c("肠道健康", "心血管健康", "脑健康", "免疫系统", "骨骼健康", "代谢健康")
filenames <- c("03_gut_health", "04_cardiovascular", "05_brain_health",
"06_immune_system", "07_bone_health", "08_metabolism")
for (i in seq_along(themes)) {
theme_nutrients <- themes[[i]]
available <- theme_nutrients[theme_nutrients %in% unique(dtas_all$nutrition)]
if (length(available) > 0) {
cat(sprintf("生成地图%d: %s...\n", i+2, titles[i]))
p <- plot_multi_world_map(
data = dtas_all %>% filter(nutrition %in% available),
nutrition_filter = available,
value_col = "median",
color_scheme = color_schemes[i],
continuous_scale = FALSE,
n_breaks = 5,
ncol = ifelse(length(available) > 4, 3, 2),
nrow = ifelse(length(available) > 4, 2, 2),
title = sprintf("Global %s Nutrients", titles[i])
)
ggsave(file.path(output_dir, sprintf("%s.png", filenames[i])),
plot = p, width = 14, height = 10, dpi = 300)
cat(sprintf("✅ 地图%d已保存\n\n", i+2))
}
}
cat("✅✅✅ 第五章所有地图已生成!\n")
cat(" 保存位置:", normalizePath(output_dir), "\n")
第五章疾病与营养素交互地图完成 | GlobalDietaryR包完全教程 | 生成日期: 2025-11-12
浙公网安备 33010602011771号