我缺少R的一些基础知识。
如何为数据框中的每一列绘制一个图?
我尝试分别为每列绘制图。我想知道是否有更简单的方法?
library(dplyr)
library(ggplot2)
data(economics)
#scatter plots
ggplot(economics,aes(x=pop,y=pce))+
geom_point()
ggplot(economics,y=psavert))+
geom_point()
ggplot(economics,y=uempmed))+
geom_point()
ggplot(economics,y=unemploy))+
geom_point()
#boxplots
ggplot(economics,aes(y=pce))+
geom_boxplot()
ggplot(economics,aes(y=pop))+
geom_boxplot()
ggplot(economics,aes(y=psavert))+
geom_boxplot()
ggplot(economics,aes(y=uempmed))+
geom_boxplot()
ggplot(economics,aes(y=unemploy))+
geom_boxplot()
我要寻找的是具有ggplot2的1个箱形图2 * 2和1个2 * 2散布图。我知道有些面网格无法理解如何实现。(我相信可以使用par(mfrow())和基本R图轻松实现。我在其他地方看到了使用扩大数据的功能吗?不明白。