Running examples in 'rgeomorphon-Ex.R' failed
The error most likely occurred in:

> ### Name: forms_matrix
> ### Title: Create a 'forms_matrix' object
> ### Aliases: forms_matrix get_forms_grass_enum
> 
> ### ** Examples
> 
> ## Don't show: 
> if (requireNamespace("terra")) (if (getRversion() >= "3.4") withAutoprint else force)({ # examplesIf
+ ## End(Don't show)
+ 
+ library(terra)
+ library(rgeomorphon)
+ 
+ # default values
+ x <- forms_matrix_get(num_forms = 10, levels = get_forms_grass_enum())
+ 
+ # inspect
+ x
+ 
+ # create a 9-class system where PEAK is combined with RIDGE
+ x[x == 2] <- 3
+ a <- get_forms_grass_enum()
+ a <- a[!names(a) == "G_PK"]
+ 
+ # create a forms matrix with custom levels
+ fm <- forms_matrix(x, a)
+ 
+ # run geomorphon algorithm
+ SEARCH = 7       # outer search radius (cells)
+ SKIP = 1         # inner skip radius (cells)
+ DIST = 0         # flatness distance (cells)
+ FLAT = 1         # flat angle threshold
+ MODE = "anglev1" # comparison mode
+ 
+ ## classic volcano
+ data("volcano", package = "datasets")
+ dem <- terra::rast(volcano)
+ terra::crs(dem) <- terra::crs("EPSG:2193")
+ terra::ext(dem) <- c(1756968, 1757578, 5917000, 5917870)
+ names(dem) <- "elevation"
+ 
+ # include original forms, positive, and negative output
+ res <- geomorphons(
+     dem,
+     search = SEARCH,
+     skip = SKIP,
+     dist = DIST,
+     flat = FLAT,
+     comparison_mode = MODE,
+     forms = TRUE,
+     positive = TRUE,
+     negative = TRUE
+ )
+ 
+  # apply custom classification to positive and negative
+  res2 <- geomorphon_theme(
+    forms_matrix_apply(
+        x = res[[c("positive", "negative")]],
+        rcl = fm
+    )
+  )
+ 
+  # compare with default
+  terra::plot(terra::rast(c(`10 form`=res$forms, `9 form`=res2)))
+ ## Don't show: 
+ }) # examplesIf
Loading required namespace: terra
> library(terra)
terra 1.8.86
> library(rgeomorphon)
> x <- forms_matrix_get(num_forms = 10, levels = get_forms_grass_enum())
> x
<forms_matrix> object

      pos=0  pos=1  pos=2  pos=3  pos=4  pos=5  pos=6  pos=7  pos=8 
neg=0 G_FL   G_FL   G_FL   G_FS   G_FS   G_VL   G_VL   G_VL   G_PT  
neg=1 G_FL   G_FL   G_FS   G_FS   G_FS   G_VL   G_VL   G_VL   G_NONE
neg=2 G_FL   G_SH   G_SL   G_SL   G_HL   G_HL   G_VL   G_NONE G_NONE
neg=3 G_SH   G_SH   G_SL   G_SL   G_SL   G_HL   G_NONE G_NONE G_NONE
neg=4 G_SH   G_SH   G_SP   G_SL   G_SL   G_NONE G_NONE G_NONE G_NONE
neg=5 G_RI   G_RI   G_SP   G_SP   G_NONE G_NONE G_NONE G_NONE G_NONE
neg=6 G_RI   G_RI   G_RI   G_NONE G_NONE G_NONE G_NONE G_NONE G_NONE
neg=7 G_RI   G_RI   G_NONE G_NONE G_NONE G_NONE G_NONE G_NONE G_NONE
neg=8 G_PK   G_NONE G_NONE G_NONE G_NONE G_NONE G_NONE G_NONE G_NONE
> x[x == 2] <- 3
> a <- get_forms_grass_enum()
> a <- a[!names(a) == "G_PK"]
> fm <- forms_matrix(x, a)
> SEARCH = 7
> SKIP = 1
> DIST = 0
> FLAT = 1
> MODE = "anglev1"
> data("volcano", package = "datasets")
> dem <- terra::rast(volcano)
> terra::crs(dem) <- terra::crs("EPSG:2193")
Warning: PROJ: proj_create_from_database: Cannot find proj.db (GDAL error 1)
Error: [rast] empty srs
Execution halted