Skip to content

Instantly share code, notes, and snippets.

@tobigithub
Created September 24, 2015 06:43
Show Gist options
  • Save tobigithub/9a0925630fc830c1891d to your computer and use it in GitHub Desktop.
Save tobigithub/9a0925630fc830c1891d to your computer and use it in GitHub Desktop.
# caret plot functions
# http://machinelearningmastery.com/data-visualization-with-the-caret-r-package/
library(caret)
# load the data
data(iris)
windows()
# pair-wise plots of all 4 attributes, dots colored by class
featurePlot(x=iris[,1:4], y=iris[,5], plot="pairs", auto.key=list(columns=3))
windows()
# density plots for each attribute by class value
featurePlot(x=iris[,1:4], y=iris[,5], plot="density", scales=list(x=list(relation="free"), y=list(relation="free")), auto.key=list(columns=3))
windows()
# box and whisker plots for each attribute by class value
featurePlot(x=iris[,1:4], y=iris[,5], plot="box", scales=list(x=list(relation="free"), y=list(relation="free")), auto.key=list(columns=3))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment