BCG.ContLevelText: BCG Continuous Value to Text Level

View source: R/BCG.ContLevel.R

BCG.ContLevelTextR Documentation

BCG Continuous Value to Text Level

Description

Convert Biological Condition Gradient (BCG) continuous value to level text.

Usage

BCG.ContLevelText(ContValue)

Arguments

ContValue

Vector of continuous BCG levels (0 to 6).

Details

Internal function to get narrative BCG level based on the continuous level.

'status' is the BCG Level as a number (x/y tie is x.5, the rest are integers).

'status_pm' is the BCG Level with +/- descriptors.

Value

Returns a dataframe of BCG levels ('status' and 'status_pm') along with input values ('value').

Examples

# construct a dummy dataset
L1 <- c(rep(0, 12))
L2 <- c(0.4, 0, 0.4, rep(0,7), 0, 0)
L3 <- c(0.6, 0, 0.6, 0, 0.42, 0, 1, 1, 0.22, 0.33, 0.5, 0)
L4 <- c(0, 0.9, 0, 0, 0.58, 0.05, 0, 0, 0.78, 0.67, 0.5, 0)
L5 <- c(0, 0.1, 0, 1, 0, 0.95, rep(0,4), 0, 1)
L6 <- c(rep(0, length(L1)))
SAMPLEID <- LETTERS[1:length(L1)]
df_lev_memb <- data.frame(SAMPLEID = SAMPLEID
                          , L1 = L1
                          , L2 = L2
                          , L3 = L3
                          , L4 = L4
                          , L5 = L5
                          , L6 = L6)

# Calculate BCG Level Assignments
df_Levels <- BCG.Level.Assignment(df_lev_memb)

# Run Function
BCG_Status <- BCG.ContLevelText(df_Levels[, "Continuous_BCG_Level"])


leppott/BCGcalc documentation built on April 12, 2024, 8:35 a.m.