0

同様の質問がここで回答されました。ただし、この問題は少し異なり、その解決策を適用できません。site-with-data フォーマットを使用して maxent をフィッティングしました。問題は、適合モデルを投影できないことです。m1パス内の出力はD:/maxent問題ないようです。この 2 つのエラー (以下) は rJava に関連していると思われますが、解決策がわかりません。以下のコードを参照してください。

> m1 <- maxent(x = d, p = id, path = "D:/maxent", 
             args = c("-P", "noautofeature", "nolinear", "noquadratic", "nothreshold", 
                      "noproduct", "betamultiplier=1", "replicates=10", "crossvalidate"))

# here d is a dataframe containing 11213 rows and 20 predictor columns (with numeric values), id is a vector containing numeric values of 1 and 0 (representing species presence and absence)
Loading required namespace: rJava
> plot(m1, xlim=c(0,100))
Error in as.double(y) : 
  cannot coerce type 'S4' to vector of type 'double'

> ras <- raster("E:/bio12.tif") # raster to project the fitted model 'm1'

> pred.m1 <- raster::predict(m1, ras)
Error in .local(object, ...) : missing layers (or wrong names)

ラスターファイルのプロパティは次のとおりです

> ras
class       : RasterLayer 
dimensions  : 4292, 4936, 21185312  (nrow, ncol, ncell)
resolution  : 0.008333333, 0.008333333  (x, y)
extent      : 112.8917, 154.025, -43.75833, -7.991667  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0 
data source : E:/Predictors_grasshoppers/selected.predictors/bio12.tif 
names       : bio12 
values      : 79, 7625  (min, max)

更新: m1 で一重引用符を使用しようとしましたが、問題はまだあります。

> m2 <- maxent(x = d, p = id, path = 'D:/PhD related/Historic climate data Australia/maxent2', 
             args = c('-P', 'noautofeature', 'nolinear', 'noquadratic', 'nothreshold', 
                      'noproduct', 'betamultiplier=1', 'replicates=10', 'crossvalidate'))
4

1 に答える 1