[R-sig-Geo] terra::app

Thayn, Jonathan jth@yn @end|ng |rom ||@tu@edu
Thu Sep 29 05:27:16 CEST 2022


I keep getting the following message when using terra:app –– Error: [app] the number of values returned by 'fun' is not appropriate. I can’t figure out what I’m doing wrong. A sample code is below:




library(terra)
the.raster <- rast(ncol=4,nrow=4)
the.raster[] <- sample(0:65535,16)

get.snow <- function(j){
k <- as.numeric(intToBits(j)[10:11])
m <- k%*%1:2
return(m)
}

new.raster <- app(the.raster,get.snow)


	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list