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 filelas<- readLAS(system.file("extdata", "Megaplot.laz", package="lidR"))
# set optionsval<-3# get metrics without functionrast<- pixel_metrics(las, length(X) >val, res=1)
# -> works# get metrics with functiondummy<-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:
This is an issue of scope. It searches X and minimum in the data.frame. minimum not being in in the data.frame it searched in the global environment. It works like that since the beginning. I don't know how to enhance it.
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: