O'Reilly logo

Practical Predictive Analytics by Ralph Winters

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Visual plotting of the variables

Sometimes you may want to generate plots for all of the variables layed out in a matrix. While there are many packages available which will do this automatically, you can also do this yourself in code, as I have shown below. I have also limited to bar plots in which the number of levels are less than or equal to 20. I might want to look at the others later, and possibly condense some of the categories, however this shows me enough variables to get started:

colors = c("blue","green3","orange") numcols <- length(names(df)) par(mfrow=c(3,5)) for(i in 1:numcols){   if(is.factor(df[,i])){     if( as.integer(nlevels(df[,i]) <= 20) ) plot(df[,i],main=names(df)[i],col=colors)   }  else{hist(df[,i],main=names(df)[i],xlim=c(0,300000),breaks=100,xlab=names(df)[i],col=colors) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required