library(magrittr)
library(dplyr)
# LAD profiles derived from normalized ALS data after applying [lad.profile()] function
LAD_profiles <- read.table(system.file("extdata", "LAD_profiles.txt", package = "LadderFuelsR"),
header = TRUE)
LAD_profiles$treeID <- factor(LAD_profiles$treeID)
trees_name1 <- as.character(LAD_profiles$treeID)
trees_name2 <- factor(unique(trees_name1))
percentile_list1<-list()
for (i in levels(trees_name2)) {
tree1 <- LAD_profiles |> dplyr::filter(treeID == i)
percentiles <- calculate_gaps_perc (tree1,min_height=1.5)
percentile_list1[[i]] <- percentiles
}
gaps_perc <- dplyr::bind_rows(percentile_list1)
gaps_perc$treeID <- factor(gaps_perc$treeID)
Run the code above in your browser using DataLab