breaks_lm <- rdrobust(AQI ~ PM2.5 + PM10 + O3 + SO2 + NO2 + CO + zc,data=daily_AQI) Error in rdrobust(AQI ~ PM2.5 + PM10 + O3 + SO2 + NO2 + CO + zc, data = daily_AQI) : unused argument (data = daily_AQI)
时间: 2023-06-27 09:03:33 浏览: 167
这个错误可能是因为 `rdrobust` 函数并不支持 `data` 参数。可以尝试将 `data` 参数移除,将数据作为 formula 中的一部分,如下所示:
```
breaks_lm <- rdrobust(AQI ~ PM2.5 + PM10 + O3 + SO2 + NO2 + CO + zc, daily_AQI)
```
如果问题仍然存在,可以查看函数 `rdrobust` 的帮助文档,看看是否有其他参数的使用问题。
相关问题
> breaks_lm <- rdrobust(AQI ~ PM2.5 + PM10 + O3 + SO2 + NO2 + CO + zc,daily_AQI,c = my_breaks) Error in complete.cases(y) : 'type'(language)参数不对
这个错误信息提示了一个函数参数不正确的问题。根据错误信息来看,似乎是在调用`rdrobust`函数时出现了问题,具体地说,是在`daily_AQI`变量中存在缺失值,而`rdrobust`函数默认要求输入数据集中没有缺失值。因此,建议您先检查`daily_AQI`数据集中是否存在缺失值,如果有的话,可以使用`na.omit()`函数或其他方法去除缺失值后再进行分析。另外,还需要检查一下`my_breaks`是否正确定义了分组断点。
pairs(data, lower.panel = function(x, y) { points(x, y, pch = 19, cex = 0.5, col = "#3C9668") abline(lm(y ~ x), col = "red") }, diag.panel = function(x) { hist(x,col = "#D8EAF6",probability = TRUE,axes = FALSE,main = "",breaks = "FD") }, upper.panel = function(x, y) { corr_text <- round(cor(x, y), 2) symbol_size <- abs(corr_text) * 5 color_scale <- colorRampPalette(c("#F09576","white","#175A9E")) # 颜色比例尺 symbol_color <- color_scale(5 + corr_text * 5) #symbol_color <- ifelse(corr_text >= 0, "#F09576","#175A9E") symbols(1, 1, circles = symbol_size, inches = FALSE, bg = symbol_color) text(mean(x), mean(y), corr_text, cex = symbol_size*0.7, font = 1) }, labels = c("FBD", "VC", "EO","OF","DP","VC-FBD","EO-VC","OF-EO","DP-OF","DP-EO"), font.labels = list(cex = 1.5))又出现Error in plot.new() : figure margins too large的问题。怎么解决
这个错误通常是由于图形边距设置过大导致的。你可以尝试调整 `mar` 参数的值,来缩小图形边距。例如将 `mar` 设置为 `c(5, 4, 4, 2) + 0.1`,如果还是不行,可以进一步调整参数值。另外,你也可以将 `oma` 参数设置为较小的值,来进一步缩小图形的边距。例如:
```
pairs(data,
lower.panel = function(x, y) {
points(x, y, pch = 19, cex = 0.5, col = "#3C9668")
abline(lm(y ~ x), col = "red")
},
diag.panel = function(x) {
hist(x,col = "#D8EAF6",probability = TRUE,axes = FALSE,main = "",breaks = "FD")
},
upper.panel = function(x, y) {
corr_text <- round(cor(x, y), 2)
symbol_size <- abs(corr_text) * 5
color_scale <- colorRampPalette(c("#F09576","white","#175A9E")) # 颜色比例尺
symbol_color <- color_scale(5 + corr_text * 5) #symbol_color <- ifelse(corr_text >= 0, "#F09576","#175A9E")
symbols(1, 1, circles = symbol_size, inches = FALSE, bg = symbol_color)
text(mean(x), mean(y), corr_text, cex = symbol_size*0.7, font = 1)
},
labels = c("FBD", "VC", "EO","OF","DP","VC-FBD","EO-VC","OF-EO","DP-OF","DP-EO"),
font.labels = list(cex = 1.5),
mar = c(5, 4, 4, 2) + 0.1,
oma = c(0.5, 0.5, 0.5, 0.5)
)
```
你可以根据实际情况适当调整参数值。
阅读全文