## The following code will result in exactly the same output
## as the one obtained from the original data set
data(bush10)
plot(bush10)
CovNAMcd(bush10)
if (FALSE) {
## This is the code with which the missing data were created:
## Creates a data set with missing values (for testing purposes)
## from a complete data set 'x'. The probability of
## each item being missing is 'pr'.
##
getmiss <- function(x, pr=0.1){
library(Rlab)
n <- nrow(x)
p <- ncol(x)
bt <- rbern(n*p, pr)
btmat <- matrix(bt, nrow=n)
btmiss <- ifelse(btmat==1, NA, 0)
x+btmiss
}
}
Run the code above in your browser using DataLab