Search code examples
rpoint-cloudslidarlidr

How to pass a list to the filter_poi function in r?


I have a list of treeID which has cloud points that are less than 100. i dont want these treeID in my lidar data. How can i pass the list to the filter_poi in the lidr library to remove these cloud points.

las_i <- filter_poi(las,treeID != 2)

Here i will get las data without the treeID 2. But instead of only 2 i want to pass all the treeID in my list to the filter_poi.

list = [1,6]

I could do something like

las <- filter_poi(las, (treeID != 1) & (treeID !=6))

This works but as i have hundreds of treeId it is something not feasible.

How can i pass all my values from a list at once


Solution

  • With the comment from I_O. I managed to make it work.

    The code below will exclude the number of treeID that i dont want.

    finallas <- filter_poi(las,!treeID %in% treeidlist)