Displaying 1 result from an estimated 1 matches for "isnonterminalna".
2010 Jun 01
0
selecting monotone pattern of missing data from a dataframe with mixed pattern of missingness
...as earlier furnished (from R-help) with the function below:
f <- function (x) {
stopifnot(is.data.frame(x))
o <- do.call(order, c(list(rowSums(is.na(x))), lapply(x[,
order(-sapply(x, function(x) sum(is.na(x))))], function(x) is.na(x))))
xo <- x[o, , drop = FALSE]
isNonterminalNA <- function(x) is.na(x) &
rev(cummax(!is.na(rev(x))) > 0)
good <- rep(TRUE, nrow(x))
for (j in seq(along = x)) {
good <- good & !isNonterminalNA(xo[, j, drop = TRUE])
}
xo[good, , drop = FALSE]
}
The function works well when the measureme...