@@ -322,7 +322,8 @@ process_pmayores <- function(data) {
322
322
# # Remove NA
323
323
dplyr :: filter(
324
324
! is.na(d_mm ),
325
- h_m > 0
325
+ h_m > 0 ,
326
+ d_mm > = 75
326
327
) | >
327
328
# # Get diametric classes
328
329
dplyr :: mutate(
@@ -331,7 +332,7 @@ process_pmayores <- function(data) {
331
332
# # Calculate number of trees per plot and species
332
333
dplyr :: summarise(
333
334
# Ht = mean(Ht, na.rm = TRUE),
334
- n = n(),
335
+ n = dplyr :: n(),
335
336
.by = c(plot , species_name , dclass , h_m )
336
337
) | >
337
338
# # Calculate average height
@@ -412,7 +413,7 @@ nest_ifn_tree <- function(data, codes, agents, which = "current", ifn = 4, proce
412
413
# # PROCESS PREVIOUS IFN
413
414
# # PROCESS PREVIOUS IFN 4
414
415
if (ifn == 4 ) {
415
- first_level <- data_lst $ PCMayores3 | >
416
+ first_level <- data $ PCMayores3 | >
416
417
dplyr :: mutate(d_mm = (Dn1 + Dn2 ) / 2 ) | >
417
418
merge(codes , by.x = " Especie" , by.y = " species_code" ) | >
418
419
merge(agents , by.x = " Agente" , by.y = " agent_code" ) | >
@@ -430,7 +431,7 @@ nest_ifn_tree <- function(data, codes, agents, which = "current", ifn = 4, proce
430
431
431
432
} else {
432
433
# # PROCESS PREVIOUS IFN 3
433
- first_level <- data_lst $ PCMayores2 | >
434
+ first_level <- data $ PCMayores2 | >
434
435
dplyr :: mutate(d_mm = (Diametro1 + Diametro2 ) / 2 ) | >
435
436
merge(codes , by.x = " Especie" , by.y = " species_code" ) | >
436
437
dplyr :: select(
@@ -515,7 +516,7 @@ nest_ifn_regeneration <- function(data, codes, process_level = 1) {
515
516
# '
516
517
# ' @return An \code{sf} object
517
518
# ' @keywords internal
518
- process_ifn <- function (data , process_level = 1 , ifn = 4 ) {
519
+ process_ifn <- function (data , process_level = 1 , ifn = 4 , province_fix ) {
519
520
# # process individually
520
521
data_sf <- data $ PCDatosMap_sf | >
521
522
dplyr :: select(province = Provincia , plot = Estadillo ) | >
@@ -524,13 +525,17 @@ process_ifn <- function(data, process_level = 1, ifn = 4) {
524
525
tree_tbl <- nest_ifn_tree(data , ifn_codes_tbl , ifn_agent_tbl , which = " current" , ifn = ifn , process_level = process_level )
525
526
tree_ifn3_tbl <- nest_ifn_tree(data , ifn_codes_tbl , ifn_agent_tbl , which = " prev" , ifn = ifn , process_level = process_level )
526
527
regeneration_tbl <- nest_ifn_regeneration(data , ifn_codes_tbl , process_level = process_level )
527
-
528
+ # # rename previous ifn
529
+ if (ifn == 4 ) names(tree_ifn3_tbl ) <- c(" plot" , " tree_ifn3" ) else names(tree_ifn3_tbl ) <- c(" plot" , " tree_ifn2" )
528
530
# # merge all together
529
- dplyr :: left_join(data_sf , tree_tbl ) | >
530
- dplyr :: left_join(tree_ifn3_tbl ) | >
531
- dplyr :: left_join(shrub_tbl ) | >
532
- dplyr :: left_join(regeneration_tbl ) | >
533
- dplyr :: relocate(geometry , .after = 7 )
531
+ suppressMessages({
532
+ dplyr :: left_join(data_sf , tree_tbl ) | >
533
+ dplyr :: left_join(tree_ifn3_tbl ) | >
534
+ dplyr :: left_join(shrub_tbl ) | >
535
+ dplyr :: left_join(regeneration_tbl ) | >
536
+ dplyr :: relocate(geometry , .after = 7 )
537
+ })
538
+
534
539
}
535
540
536
541
0 commit comments