response.plot3() 使 RStudio 崩溃

问题描述

0。会话信息

> sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

1.我的问题摘要

我在使用名为 response.plot2()修改后的 response.plot3() 函数时发生了崩溃。问题不在于函数本身,因为 response.plot2() 也会出现同样的问题。

image

2.代码

library(biomod2)
library(raster)
library(reshape)
library(ggplot2)

setwd("xxx")

# I load the modified version of response.plot2()
source("/response.plot_modified.R",local = TRUE)

sp <- "NAME"
baseline_EU <- readRDS("./data/baseline_EU.rds")

initial.wd <- getwd()
setwd("models") 

# Loading of formatted data and models calibrated by biomod
load(paste0(sp,"/run.data"))
load(paste0(sp,"/model.runs"))

# Variables used for calibration
cur.vars <- model.runs@expl.var.names
  
# Loading model names into R memory
models.to.plot <- BIOMOD_LoadModels(model.runs)
 
# Calculation of response curves with all models (stored in the object resp which is an array)
resp <- response.plot3(models = models.to.plot,Data = baseline_EU[[cur.vars]],fixed.var.metric = "sp.mean",show.variables = cur.vars,run.data = run.data)

我有 60 个模型,代码在中止会话之前绘制了第一条曲线,没有进一步的解释。

3.我没有成功的尝试

(1) 检查这不是内存问题 (2) 卸载-重新安装所有包及其依赖项 (3) 更新到最后一个 R 版本 (4) 返回 response.plot2() 查看问题是否来自 response.plot3()

4.我发现了一些类似的错误,这让我认为这可能是一个包问题

https://github.com/rstudio/rstudio/issues/9373

Call to library(raster) or require(raster) causes Rstudio to abort session

现在我认为 biomod2 或光栅包有问题,或者 R 版本有问题?

如果您有任何想法,我将不胜感激。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)