View source: R/BCG.Metric.Membership.R
BCG.Metric.Membership | R Documentation |
Biological Condition Gradient fuzzy membership for metrics.
BCG.Metric.Membership(
df.metrics,
df.rules,
input.shape = "wide",
col_SAMPLEID = "SAMPLEID",
col_INDEX_NAME = "INDEX_NAME",
col_INDEX_CLASS = "INDEX_CLASS",
col_LEVEL = "LEVEL",
col_METRIC_NAME = "METRIC_NAME",
col_RULE_TYPE = "RULE_TYPE",
col_LOWER = "LOWER",
col_UPPER = "UPPER",
col_METRIC_VALUE = "METRIC_VALUE",
col_INCREASE = "INCREASE",
...
)
df.metrics |
Wide data frame with metric values to be evaluated. |
df.rules |
Data frame of metric thresholds to check. |
input.shape |
Shape of df.metrics; wide or long. Default is wide. |
col_SAMPLEID |
Column name for sample id. Default = "SAMPLEID" |
col_INDEX_NAME |
Column name for index name. Default = "INDEX_NAME" |
col_INDEX_CLASS |
Column name for index class Default = "INDEX_CLASS" |
col_LEVEL |
Column name for level. Default = "LEVEL" |
col_METRIC_NAME |
Column name for metric name. Default = "METRIC_NAME" |
col_RULE_TYPE |
Column name for rule type (e.g., Rule0). Default = "RULE_TYPE" |
col_LOWER |
Column name for lower limit. Default = "LOWER" |
col_UPPER |
Column name for upper limit. Default = "UPPER" |
col_METRIC_VALUE |
Column name for metric value. Default = "METRIC_VALUE" |
col_INCREASE |
Column name for if the metric value increases. Default = "INCREASE" |
... |
Arguments passed to 'BCG.MetricMembership' used internally |
Converts metric values into BCG membership values. Uses a rules table to define the metrics, scoring range, and direction for each named index.
Deprecated col_SITE_TYPE for col_INDEX_CLASS in v2.0.0.9001.
Returns a data frame of results in the long format.
# library(readxl)
# library(BioMonTools)
# Calculate Metrics
df_samps_bugs <- readxl::read_excel(
system.file("extdata/Data_BCG_PugLowWilVal.xlsx"
, package = "BCGcalc")
, guess_max = 10^6)
myDF <- df_samps_bugs
myCols <- c("Area_mi2", "SurfaceArea", "Density_m2", "Density_ft2")
# populate missing columns prior to metric calculation
col_missing <- c("INFRAORDER", "HABITAT", "ELEVATION_ATTR", "GRADIENT_ATTR"
, "WSAREA_ATTR", "HABSTRUCT", "UFC")
myDF[, col_missing] <- NA
df_met_val_bugs <- BioMonTools::metric.values(myDF
, "bugs"
, fun.cols2keep = myCols)
# Import Rules
df_rules <- readxl::read_excel(system.file("extdata/Rules.xlsx"
, package = "BCGcalc")
, sheet="Rules")
# Run function
df_met_memb <- BCG.Metric.Membership(df_met_val_bugs, df_rules)
# Show Results
#View(df_met_memb)
# Save Results
write.table(df_met_memb
, file.path(tempdir(), "Metric_Membership.tsv")
, row.names = FALSE
, col.names = TRUE
, sep = "\t")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.