我的代码的数据是
payments <- read.csv("payments.csv", header = TRUE)
使用了我在这里上传的数据文件payments.csv:
https://github.com/Bheal/Board-Q-A
我正在学习R并希望在基础绘图中完成相同的ggplot(payments, aes( x = Average.Total.Payments, y = Average.Covered.Charges)) + geom_point() + facet_grid(DRG.Definition ~ Provider.State)
,所以我尝试了这个:
par(mfrow = c(6,6))
for(state in unique(payments$Provider.City)) {
for(condition in unique(payments$DRG.Definition)) {
data.sub <- subset(payments, Provider.State == state & DRG.Definition == condition)
with(data.sub, plot(Average.Total.Payments ~ Average.Covered.Charges))
}
}
我收到以下错误:
Error in plot.new() : figure margins too large
In addition: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf
3: In min(x) : no non-missing arguments to min; returning Inf
4: In max(x) : no non-missing arguments to max; returning -Inf
我相信首先我必须尝试par()
设置。也许我想要的6x6面板会显示,但不知道从哪里开始,当我在网上搜索时,想在此发布此相关评论和建议。感谢。