You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I am not sure whether I found a bug, a feature or if I wrote bad code, but I have some code which is not working like I expected. I have an example here:
# load file
las <- readLAS(system.file("extdata", "Megaplot.laz", package="lidR"))
# set options
val <- 3
# get metrics without function
rast <- pixel_metrics(las, length(X) > val, res = 1)
# -> works
# get metrics with function
dummy <- function(las, minimum) {
rast <- pixel_metrics(las, length(X) > minimum, res = 1)
}
dummy(las = las, minimum = val)
# -> does not work
When I use pixel_metrics inside a function, it does not work. I get an error that the variable "minimum" wasn't found. I get this traceback:
Fehler: Objekt 'minimum' nicht gefunden
10. `[.data.table`(las@data, , if (!anyNA(.BY)) length(X) > minimum, by = .(cells, echo)) at <text>#1
9. las@data[, if (!anyNA(.BY)) length(X) > minimum, by = .(cells, echo)] at <text>#1
8. eval(parse(text = cmd))
7. eval(parse(text = cmd))
6. metrics_classic(las, call, grp, filter)
5. template_metrics.LAS(las, func, template, ...)
4. template_metrics(las, func, template, ...)
3. pixel_metrics.LAS(las, length(X) > minimum, res = 1)
2. pixel_metrics(las, length(X) > minimum, res = 1)
1. dummy(las = las, minimum = val)
I am happy about any help!
The text was updated successfully, but these errors were encountered:
Hello, I am not sure whether I found a bug, a feature or if I wrote bad code, but I have some code which is not working like I expected. I have an example here:
When I use pixel_metrics inside a function, it does not work. I get an error that the variable "minimum" wasn't found. I get this traceback:
I am happy about any help!
The text was updated successfully, but these errors were encountered: