data(abr1)
cls <- factor(abr1$fact$class)
dat <- abr1$pos
## fill zeros with NAs
dat <- mv.zene(dat)
## missing values summary
mv <- mv.stats(dat, grp=cls)
mv ## View the missing value pattern
## filter missing value variables
dat <- dat[,mv$mv.var < 0.15]
## fill NAs with mean
dat <- mv.fill(dat,method="mean")
## log transformation
dat <- preproc(dat, method="log10")
## select class "1" and "2" for feature ranking
ind <- grepl("1|2", cls)
mat <- dat[ind,,drop=FALSE]
mat <- as.matrix(mat)
grp <- cls[ind, drop=TRUE]
## apply random forests for feature selection/ranking
res <- fs.rf(mat,grp)
res.1 <- fs.rf.1(mat,grp)
## compare the results
fs <- cbind(fs.rf=res$fs.order, fs.rf.1=res.1$fs.order)
## plot the important score of 'fs.rf' (not 'fs.rf.1')
score <- res$stats
score <- sort(score, decreasing = TRUE)
plot(score)
Run the code above in your browser using DataLab