Skip to content

Commit

Permalink
up date the function str_filter_data
Browse files Browse the repository at this point in the history
  • Loading branch information
GeraldineDerroire committed Dec 7, 2024
1 parent 0c1dde2 commit c6ee5ae
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions R/str_filter_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#' @param propDetMin numeric minimum proportion of fully determined individuals in a plot, used for filtering (default 80)
#' @param Strat2keep vector listing all the strata to keep (default all the strata from 50mm DBH in database V6)
#' @param EFG2keep EFG to keep (default the 9 EFG used for paper on diversity patterns)
#' @param keepMorpho a boleean specifying if the morphospecies are kept (defaut is False)
#'
#' @return the rds file of the whole database after filtering
#' (only the SpeciesObservations, Plots and CommunityObservations) are updated.
Expand Down Expand Up @@ -42,7 +43,8 @@ filter_data <- function(nIndivMin = 50, # minimum number of trees in a plot to k
"T1.3 Tropical/Subtropical montane rainforests",
"T4.2 Pyric tussock savannas",
"T2.4 Warm temperate laurophyll forests",
"T3.1 Seasonally dry tropical shrublands")) # the EFG to consider
"T3.1 Seasonally dry tropical shrublands"), # the EFG to consider
keepMorpho = FALSE) # do we want to keep the morpho sp?
{
# Retreive spobs and plot data sets
Data_SpObs <- as.data.table(Data$SpeciesObservations)
Expand All @@ -65,7 +67,9 @@ filter_data <- function(nIndivMin = 50, # minimum number of trees in a plot to k
# length(unique(Data_SpObs$organismNameCurated))

# filtering out the morpho-species
Data_SpObs <- Data_SpObs[organismNameTaxonRank == "species"]
if (keepMorpho == FALSE) {
Data_SpObs <- Data_SpObs[organismNameTaxonRank == "species"]
}
# length(unique(Data_SpObs$organismNameCurated))

# filtering out the strata not in strata2keep
Expand Down

0 comments on commit c6ee5ae

Please sign in to comment.