conversion of text representing a number, but possibly starting with "<" or ">" to indicate that the number exceeds the detection limit of an analysis method, to a valid number
Usage
hsLabValToVal(
x,
country,
detLimFactorBelow = 0.5,
detLimFactorAbove = 2,
factors = c(`<` = detLimFactorBelow, `<<` = detLimFactorBelow, `>` =
detLimFactorAbove, `>>` = detLimFactorAbove),
stopOnError = TRUE
)
Arguments
- x
(vector of) character(s) representing values, possibly starting with "<" or ">" to indicate detection limit exceedance
- country
"en" if value is given in English format (decimal point ".", thousands separator ",") or "de" if value is given in German format (decimal point ",", thousands separator ".").
- detLimFactorBelow
factor by which detection limit is multiplied in order to get a valid value when the value was below the detection limit. Default value: 0.5
- detLimFactorAbove
factor by which detection limit is multiplied in order to get a valid value when the value was above the detection limit. Default value: 2
- factors
named vector of conversion factors to be multiplied with the numeric values if the name of the factor matches the prefix (e.g. "<", "<<", ">", ">>") found in front of the value. Set to NULL if not factors are to be applied
- stopOnError
if TRUE, the program stops on conversion errors, otherwise shows a warning
Value
data frame with columns outOfLimit being one of "" (value within detection limits), "<" (value below detection limit) or ">" (value above detection limit) and numericValue containing the value which, in case of detection limit exceedance, may be a substitute value. If there were conversion errors, the column numericValue containing the indices of the wrongly formatted values in its attribute "errorIndices".