Running examples in ‘lidR-Ex.R’ failed
The error most likely occurred in:

> ### Name: aggregate
> ### Title: Metric derivation at different levels of regularization
> ### Aliases: aggregate cloud_metrics crown_metrics hexagon_metrics
> ###   pixel_metrics plot_metrics polygon_metrics template_metrics
> ###   voxel_metrics
> 
> ### ** Examples
> 
> LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
> las <- readLAS(LASfile, filter = "-keep_random_fraction 0.5")

                                                                                
> col <- sf::sf.colors(15)
> fun1 <- ~list(maxz = max(Z))
> fun2 <- ~list(q85 = quantile(Z, probs = 0.85))
> 
> set_lidr_threads(1) ; data.table::setDTthreads(1) # for cran only
> 
> # ================
> # CLOUD METRICS
> # ================
> 
> cloud_metrics(las, .stdmetrics_z)
$zmax
[1] 29.11

$zmean
[1] 13.27629

$zsd
[1] 7.456352

$zskew
[1] -0.4764641

$zkurt
[1] 2.086569

$zentropy
[1] 0.9034754

$pzabovezmean
[1] 57.36855

$pzabove2
[1] 85.71007

$zq5
[1] 0

$zq10
[1] 0.09

$zq15
[1] 2.86

$zq20
[1] 5.79

$zq25
[1] 7.81

$zq30
[1] 9.64

$zq35
[1] 11.21

$zq40
[1] 12.63

$zq45
[1] 13.83

$zq50
[1] 14.91

$zq55
[1] 16

$zq60
[1] 16.89

$zq65
[1] 17.71

$zq70
[1] 18.53

$zq75
[1] 19.3

$zq80
[1] 20.09

$zq85
[1] 20.88

$zq90
[1] 21.79

$zq95
[1] 23.05

$zpcum1
[1] 6.52697

$zpcum2
[1] 12.03731

$zpcum3
[1] 20.22982

$zpcum4
[1] 30.04461

$zpcum5
[1] 43.09585

$zpcum6
[1] 59.87833

$zpcum7
[1] 80.14871

$zpcum8
[1] 95.21968

$zpcum9
[1] 99.55928

> 
> # ================
> # PIXEL METRICS
> # ================
> 
> m <- pixel_metrics(las, fun1, 20)
> #plot(m, col = col)
> 
> # ================
> # PLOT METRICS
> # ================
> 
> shpfile <- system.file("extdata", "efi_plot.shp", package="lidR")
> inventory <- sf::st_read(shpfile, quiet = TRUE)
> inventory # contains an ID and a Value Of Interest (VOI) per plot
Simple feature collection with 5 features and 2 fields
Geometry type: POINT
Dimension:     XY
Bounding box:  xmin: 684838.9 ymin: 5017796 xmax: 684976.6 ymax: 5017958
Projected CRS: NAD83 / UTM zone 17N
  IDPEP       VOI                 geometry
1 PEPQ1 14.157140 POINT (684976.6 5017821)
2 PEPQ2 12.720584 POINT (684923.9 5017958)
3 PEPQ3 11.396656 POINT (684838.9 5017942)
4 PEPQ4 11.597471   POINT (684855 5017891)
5 PEPQ5  8.263425   POINT (684944 5017796)
> 
> m <- plot_metrics(las, fun2, inventory, radius = 11.28)
> #plot(header(las))
> #plot(m["q85"], pch = 19, cex = 3, add = TRUE)
> 
> 
> # ================
> # VOXEL METRICS
> # ================
> 
> m <- voxel_metrics(las, length(Z), 8)
Error in `[.data.table`(by, , `:=`(GRP, .GRP), by = c("Xgrid", "Ygrid",  : 
  attempt access index 3/3 in VECTOR_ELT
Calls: voxel_metrics -> [ -> [.data.table
Execution halted