当前位置:网站首页>R 语言nutrient数据集的可视化

R 语言nutrient数据集的可视化

2022-06-22 19:17:00 Mrrunsen

在 flexclust 包中的营养数据集,它包括对27种肉、鱼和禽的营养物质的测量

energy食物能量(卡路里)。
protein蛋白质(克)。
fat脂肪(克)。
calcium钙(毫克)。
iron铁(毫克)。

数据集是否存在缺失值

data(nutrient, package="flexclust") 
library(VIM )
aggr(nutrient, prop=FALSE, numbers=TRUE)

人们常说脂肪越多, 食物能量越多,这是对吗?

ggplot(nutrient) +
  aes(x = energy , y = fat) + 
  geom_point()   + stat_smooth()

脂肪越多, 食物能量越多,散点图告诉这个观点是对的

library(ggcorrplot)
nutrient %>%
  cor() %>%
  round(2) %>%
  ggcorrplot(hc.order = TRUE,lab = TRUE)

原网站

版权声明
本文为[Mrrunsen]所创,转载请带上原文链接,感谢
https://blog.csdn.net/Mrrunsen/article/details/125404006