ltdl.fix.df {rgr}R Documentation

Replace Negative Values Representing Less Than Detects for a Data Frame

Description

Function to process a matrix or dataframe to replace negative values representing less than detects (<value) with positive half that value. This permits processing of these effectively categorical data as real numbers and their display on logarithmically scaled axes. In addition, some software packages replace blank fields that should be interpreted as NAs, i.e. no information, with zeros. The facility is provided to replace any zero values with NAs. In other instances data files have been built using an integer code, e.g., -9999, to indicate 'no data', i.e. the equivalent of NAs. The facility is provided to replace any so coded values with NAs. Any factor variables in the input matrix or data frame are passed to the output matrix or data frame.

If a single vector is to be processed, use ltdl.fix

A report of the changes made is displayed on the current device.

Usage

ltdl.fix.df(x, zero2na = FALSE, coded = NA)

Arguments

x name of the matrix or dataframe to be processed.
zero2na to replace any zero values with NAs, set zero2na = TRUE.
coded to replace any numeric coded values, e.g., -9999 with NAs, set coded = -9999.

Value

A matrix or dataframe identical to that input but where any negative values have been replaced by half their positive values, and optionally any zero values or numeric coded values have been replaced by NAs.

Note

Great care needs to be taken when processing data where a large proportion of the data are less than detects (<value). In such cases parametric statistics have limited value, and can be missleading. Records should be kept of variables containing <values, and the fixed replacement values changed in tables for reports to the appropriate <values. Thus, in tables of percentiles the <value should replace the fixed value computed from absolute(-value)/2. Various rules have been proposed as to how many less than detects treated in this way can be tolerated before means, variances, etc. become biassed and of little value. Less than 5% in a large data set is usually tolerable, with greater than 10% concern increases, and with greater than 20% alternate procedures for processing the data should be sought.

Author(s)

Robert G. Garrett and David Lorenz

See Also

ltdl.fix

Examples

## Replace any missing data coded as -9999 with NAs and any remaining
## negative values representing less than detects with Abs(value)/2
data(fix.test)
fix.test
fix.test.fixed <- ltdl.fix.df(fix.test, coded = -9999)
fix.test.fixed

## As above, and replace any zero values with NAs
fix.test.fixed <- ltdl.fix.df(fix.test, coded = -9999, zero2na = TRUE)
fix.test.fixed

[Package rgr version 1.0.3 Index]