R Package {caret} Visualization Examples

Loading {caret}

library(caret, quietly = TRUE)

Scatterplot Matrix

featurePlot(x = iris[, 1:4], 
            y = iris$Species, 
            plot = "pairs",
            ## Add a key at the top 
            auto.key = list(columns = 3))

plot of chunk unnamed-chunk-3

Scatterplot Matrix with Ellipses

featurePlot(x = iris[, 1:4], 
            y = iris$Species, 
            plot = "ellipse",
            ## Add a key at the top 
            auto.key = list(columns = 3)) 

plot of chunk unnamed-chunk-4

Box Plots

featurePlot(x = iris[, 1:4], 
            y = iris$Species, 
            plot = "box", 
            ## Pass in options to bwplot() 
            scales = list(y = list(relation="free"),
                          x = list(rot = 90)),  
            layout = c(4,1 ), 
            auto.key = list(columns = 2))

plot of chunk unnamed-chunk-5

Scatter Plots

data(BloodBrain)
regVar <- c("tpsa", "mw", "clogp")
str(bbbDescr[, regVar])
## 'data.frame':    208 obs. of  3 variables:
##  $ tpsa : num  12 49.3 50.5 37.4 37.4 ...
##  $ mw   : num  155 151 365 382 325 ...
##  $ clogp: num  2.97 0.494 5.137 5.878 4.367 ...
featurePlot(x = bbbDescr[, regVar], y = logBBB, plot = "scatter", layout = c(3, 
    1))

plot of chunk unnamed-chunk-7

featurePlot(x = bbbDescr[, regVar], y = logBBB, plot = "scatter", type = c("p", 
    "smooth"), span = 0.5, layout = c(3, 1))

plot of chunk unnamed-chunk-8