I am using the R package lidR to do some analysis on a large forestry point cloud. I am trying to write my own point_metrics()
function for identifying outliers. How can I access the X
, Y
, and Z
coordinates of the point that the metric is being run on inside of the function? For example with the following code:
is.outlier <- function(x, y, z) {
return(x)
}
point_metrics(las, ~is.outlier(X, Y, Z), k = 5)
returns the x
values of the point's k nearest neighbors. I want to find the x
value of the point in addition to the k nearest neighbors in order to find the distance away each knn is from the initial point.