Skip to content

Commit

Permalink
Fix bug with terra predict
Browse files Browse the repository at this point in the history
  • Loading branch information
kenkellner committed Jul 10, 2024
1 parent f3b0e45 commit d02963f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion R/predict.R
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ newdata_from_raster <- function(object, vars){
names(nd)[is_fac] <- gsub(rem_string, "", names(nd)[is_fac])
} else if(inherits(object, "SpatRaster")){
if(!requireNamespace("terra", quietly=TRUE)) stop("terra package required", call.=FALSE)
nd <- terra::as.data.frame(object)
nd <- terra::as.data.frame(object, na.rm=FALSE)
}
# Check if variables are missing
no_match <- vars[! vars %in% names(nd)]
Expand Down

0 comments on commit d02963f

Please sign in to comment.