我正在尝试将分发和QQ图并排存储。如果我同时通过选择行来运行这些行,我会看到我想要的图形。如果我尝试将其链接运行并存储在变量中,它将失败。
错误:
Error in par(mfrow = c(1, 2)) + hist(real_estate_db$debt, main = "Left Skewed Distribution", :
non-numeric argument to binary operator
代码:
graph_debt <- par(mfrow=c(1,2)) +
hist(real_estate_db$debt, main="Left Skewed Distribution", xlab="Debt", col="#FA5858") +
qqnorm(real_estate_db$debt, col="blue") +
qqline(real_estate_db$debt, col="red")
如何将其存储在变量中?
谢谢!
https://cran.r-project.org/web/packages/cowplot/vignettes/introduction.html
library(dplyr)
library(cowplot)
p1 <- ggplot(mtcars, aes(disp, mpg)) +
geom_point()
p2 <- ggplot(mtcars, aes(qsec, mpg)) +
geom_point()
plot_grid(p1, p2, labels = c('A', 'B'), label_size = 12)