Skip to content

Commit

Permalink
subset recruits and old stems so not flagged as duplicated #31
Browse files Browse the repository at this point in the history
  • Loading branch information
ValentineHerr committed May 16, 2023
1 parent 0ba27e6 commit 89668cc
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions R_scripts/CI_QAQC_reports.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,19 @@ library(curl)
old_tree <- fread("raw_data/old_trees/tree_table_0.csv")
recruits_tree <- fread("raw_data/recruits/tree_table_0.csv")

old_stem <- fread("raw_data/old_trees/stem_table_1.csv")
recruits_stem <- fread("raw_data/recruits/stem_table_1.csv")
old_stem <- fread("raw_data/old_trees/stem_table_1.csv")# this is essentially the same as recruits_stem, so will subset
recruits_stem <- fread("raw_data/recruits/stem_table_1.csv") # this is essentially the same as old_stem, so will subset


tree <- rbind(data.table(table = "old_trees", old_tree), data.table(table = "recruits", recruits_tree))
if( any(duplicated(tree$tag))) stop("there are duplicated tags in tree! double check how to bring in recuits")


recruits_stem$dbh_2018_mm <- old_stem$dbh_2018_mm[match(paste(recruits_stem$tag, recruits_stem$StemTag), paste(old_stem$tag, old_stem$StemTag))] # have to add this as it is missing in the recruits
old_stem <- old_stem[tag %in% old_tree$tag, ]
recruits_stem <- recruits_stem[tag %in% recruits_tree$tag, ]

recruits_stem$dbh_2018_mm <- NA

stem <- rbind(data.table(table = "old_trees", old_stem), data.table(table = "recruits", recruits_stem[, names(old_stem), with = F]))

cat("New census data loaded") # this is to troubleshoot CI on GitHub actions (see where errors happen)
Expand Down

0 comments on commit 89668cc

Please sign in to comment.