line 208 of summaryByPlot function : when there is no tree in a subplot, the result of AGB[ plot == unique(data$subplot), AGB] returns numeric(0) instead of 0. Then, the sapply of AGB = sapply(list_poly, "[[", 2)) line 212 is not a vector anymore but a list, which leads to an error.
Besides, there isn't any test in test_04_summaryByPlot with the subplot argument.
line 208 of summaryByPlot function : when there is no tree in a subplot, the result of AGB[ plot == unique(data$subplot), AGB] returns numeric(0) instead of 0. Then, the sapply of AGB = sapply(list_poly, "[[", 2)) line 212 is not a vector anymore but a list, which leads to an error. Besides, there isn't any test in test_04_summaryByPlot with the subplot argument.