R/flag2weight.R

##' Function to convert flag to information weight.
##'
##' The flag is converted to a numeric information weight for
##' quantification and further manipulation.
##'
##' @param flagObservationStatus The flag
##' @param flagTable The table mapping the flag and weights
##'
##' @export
##'

flag2weight = function(flagObservationStatus,
                       flagTable = flagWeightTable){

    index = match(flagObservationStatus, flagTable$flagObservationStatus)
    as.numeric(flagTable$flagObservationWeights[index])
}
SWS-Methodology/faoswsFlag documentation built on May 9, 2019, 11:47 a.m.