From 7a06221b6f53670f731945061b4ef4016efeb346 Mon Sep 17 00:00:00 2001
From: jmmonnet <jean-matthieu.monnet@inrae.fr>
Date: Fri, 28 May 2021 11:30:48 +0200
Subject: [PATCH] use of add_attribute in tree detection

---
 R/tree.detection.Rmd | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/R/tree.detection.Rmd b/R/tree.detection.Rmd
index 30608d0..09c1c30 100644
--- a/R/tree.detection.Rmd
+++ b/R/tree.detection.Rmd
@@ -302,7 +302,7 @@ Before computation of point cloud metrics in each segment, the whole point cloud
 # normalize point cloud
 lasn <- lidR::normalize_height(laschablais3, lidR::tin())
 # add segment id in LAS object
-lasn@data$seg.id <- raster::extract(segms[["segments.id"]], lasn@data[,1:2])
+lasn <- lidR::add_attribute(lasn, raster::extract(segms[["segments.id"]], lasn@data[,1:2]), "seg.id")
 # split las object by segment id
 lasl <- split(lasn@data,lasn@data$seg.id)
 # convert list of data.frames to list of las objects
-- 
GitLab