# NOT RUN {
library(mdatools)
## A very simple example of imputing missing values in a data with no noise
# generate a matrix with values
s = 1:6
odata = cbind(s, 2*s, 4*s)
# make a matrix with missing values
mdata = odata
mdata[5, 2] = mdata[2, 3] = NA
# replace missing values with approximated
rdata = pca.mvreplace(mdata, scale = TRUE)
# show all matrices together
show(cbind(odata, mdata, round(rdata, 2)))
# }
Run the code above in your browser using DataLab