Commit 41323479 authored by Romulo Pereira Goncalves's avatar Romulo Pereira Goncalves
Browse files

Predict using the raster in memory.

parent 8286db60
...@@ -289,7 +289,7 @@ sample_nb <- function(raster, ...@@ -289,7 +289,7 @@ sample_nb <- function(raster,
j <- 1 j <- 1
for (i in ch) { for (i in ch) {
if (j == 1) { if (j == 1) {
result1 <- raster::predict(object = raster, model = models[[i]]) result1 <- raster::predict(object = rast, model = models[[i]])
if (is.na(switch[i]) == F) { if (is.na(switch[i]) == F) {
result1 <- result1 <-
...@@ -297,7 +297,7 @@ sample_nb <- function(raster, ...@@ -297,7 +297,7 @@ sample_nb <- function(raster,
} }
} else { } else {
result1 <- result1 <-
raster::stack( result1, raster::predict(object = raster, model = models[[i]])) raster::stack( result1, raster::predict(object = rast, model = models[[i]]))
if (is.na(switch[i]) == F) { if (is.na(switch[i]) == F) {
result1[[j]] <- result1[[j]] <-
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment