Closed Jean-Romain closed 1 year ago
library(sf) library(lidR) ctg <- readLAScatalog(system.file("extdata", "example.laz", package = "rlas")) plt <- data.frame(place = "plot_1", x = 339008, y = 5248001) plt <- st_as_sf(x = plt, coords = c("x", "y"), crs = st_crs(ctg)) r <- 11.35 myMetrics = function(z, i) { res = list( zwimean = sum(z*i)/sum(i), # Mean elevation weighted by intensities zimean = mean(z*i), # Mean products of z by intensity zsqmean = sqrt(mean(z^2)) # Quadratic mean ) return(res) } res <- plot_metrics(ctg,func = ~myMetrics(Z, Intensity), plt, radius = r) #> Error in as.list.default(X) : no method for coercing this S4 class to a vector
It works with two plots
plt = rbind(plt, plt)
It works with two plots