Learn R Programming

wrProteo (version 1.5.0)

isolNAneighb: Isolate NA-neighbours

Description

This functions extracts all replicate-values where at least one of the replicates is NA. Then, the non-NA values are sorted by the number of NAs which occored in this group of replicates. A list with all NA-neighbours organized by the number of NAs gets returned.

Usage

isolNAneighb(
  mat,
  gr,
  maxHi = 3,
  iniCheck = TRUE,
  silent = FALSE,
  callFrom = NULL
)

Arguments

mat

(matrix or data.frame) main data (may contain NA)

gr

(character or factor) grouping of columns of 'mat', replicate association

maxHi

(integer) maximum count of NAs to consider separately (higher ones will be counted/pooled as maxHi)

iniCheck

(logical) check at beginning if executing this function is useful (presence any NA)

silent

(logical) suppress messages

callFrom

(character) allow easier tracking of message(s) produced

Value

list with NA-neighbours sorted by number of NAs in replicate group

See Also

this function gets used by matrixNAneighbourImpute and testRobustToNAimputation; estimation of mode stableMode; detection of NAs na.fail

Examples

Run this code
# NOT RUN {
mat1 <- c(22.2, 22.5, 22.2, 22.2, 21.5, 22.0, 22.1, 21.7, 21.5, 22, 22.2, 22.7,
  NA, NA, NA, NA, NA, NA, NA, 21.2,   NA, NA, NA, NA,
  NA, 22.6, 23.2, 23.2,  22.4, 22.8, 22.8, NA,  23.3, 23.2, NA, 23.7,
  NA, 23.0, 23.1, 23.0,  23.2, 23.2, NA, 23.3,  NA, NA, 23.3, 23.8)
mat1 <- matrix(mat1, ncol=12, byrow=TRUE)
gr4 <- gl(3, 4)
isolNAneighb(mat1, gr4)

# }

Run the code above in your browser using DataLab