# NOT RUN {
LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
lidar = readLAS(LASfile)
# Select the first returns classified as ground
firstground = lidar %>% lasfilter(Classification == 1 & ReturnNumber == 1)
# Multiple arguments are equivalent to &
firstground = lidar %>% lasfilter(Classification == 1, ReturnNumber == 1)
# Multiple criteria
first_or_ground = lidar %>% lasfilter(Classification == 1 | ReturnNumber == 1)
# }
Run the code above in your browser using DataLab