cleanReplicates {wrMisc} | R Documentation |
Replace Most Distant Values by NA
Description
This procedures aims to streighten (clean) the most extreme values of noisy replicates by identifying the most distant points (among a set of replicates). The input 'x' (matrix or data.frame) is supposed to come from multiple different measures taken in replicates (eg weight of different individuals as rows taken as multiple replicate measures in subsequent columns).
Usage
cleanReplicates(
x,
centrMeth = "median",
nOutl = 2,
retOffPos = FALSE,
silent = FALSE,
callFrom = NULL
)
Arguments
x |
matrix (or data.frame) |
centrMeth |
(character) method to summarize (mean or median) |
nOutl |
(integer) determines how many points per line will be set to |
retOffPos |
(logical) if |
silent |
(logical) suppres messages |
callFrom |
(character) allow easier tracking of messages produced |
Details
With the argument nOutl
the user chooses the total number of most extreme values to replace by NA
.
how many of the most extreme replicates of the whole dataset will replaced by NA
, ie with nOutl=1
only the single most extreme outlyer will be replaced by NA
.
Outlier points are determined as point(s) with highest distance to (row) center (median and mean choice via argument 'centrMeth').
Thus function returns input data with "removed" points set to NA
, or if retOffPos=TRUE
the most extreme/outlier positions.
Value
This function returns a matrix of same dimensions as input x
, data-points which were tagged/removed are set to NA
, or if retOffPos=TRUE
the most extreme/outlier positions
Examples
mat3 <- matrix(c(19,20,30, 18,19,28, 16,14,35),ncol=3)
cleanReplicates(mat3, nOutl=1)