BCG.Level.Membership: BCG Level Membership

Description Usage Arguments Details Value Examples

Description

Biological Condition Gradient Level assignment given metric memberships.

Usage

1
BCG.Level.Membership(df.metric.membership, df.rules)

Arguments

df.metric.membership

Data frame of metric memberships (long format, the same as the output of BCG.Membership).

df.rules

Data frame of BCG model rules.

Details

Input is metric memberships and a rules tables. Output is a data frame with the membership for each row to each Level (1:6). Minimum of: * 1- sum of previous levels * Rule0 memberships * max of Alt1 rules (and min of Alt2 rules) That is, perform calculations in this order: 1. Min of Alt2 metric memberships 2. Max of Alt2 rules and the above result. 3. Min of Rule0, the above result, and the sum of previous levels.

Value

Returns a data frame of results in the wide format.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
library(readxl)
library(BioMonTools)

# Calculate Metrics
df.samps.bugs <- read_excel(system.file("./extdata/Data_BCG_PacNW.xlsx"
                                        , package="BCGcalc")
                           , guess_max = 10^6)
myDF <- df.samps.bugs
myCols <- c("Area_mi2", "SurfaceArea", "Density_m2", "Density_ft2", "Site_Type")
df.metric.values.bugs <- metric.values(myDF, "bugs", fun.cols2keep=myCols)

# Import Rules
df.rules <- read_excel(system.file("./extdata/Rules.xlsx"
                             , package="BCGcalc"), sheet="BCG_PacNW_v1_500ct") 

# Calculate Metric Memberships
df.Metric.Membership <- BCG.Metric.Membership(df.metric.values.bugs, df.rules)

# Calculate Level Memberships
df.Level.Membership <- BCG.Level.Membership(df.Metric.Membership, df.rules)

## Not run: 
# Show results
View(df.Level.Membership)

# Save Results
write.table(df.Level.Membership, "Level.Membership.tsv"
             , row.names=FALSE, col.names=TRUE, sep="\t")

## End(Not run)

leppott/BCGcalc documentation built on June 29, 2019, 10:41 a.m.