# NOT RUN {
LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
lidar = readLAS(LASfile)
cloud_metrics(lidar, ~max(Z))
cloud_metrics(lidar, ~mean(Intensity))
# Define your own new metrics
myMetrics = function(z, i)
{
metrics = 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(metrics)
}
metrics = cloud_metrics(lidar, ~myMetrics(Z, Intensity))
# Predefined metrics
cloud_metrics(lidar, .stdmetrics)
# }
Run the code above in your browser using DataLab