Description Usage Arguments Source See Also Examples
Generate a Scatterplot Matrix of some columns of data set using ggplot.
1 2 | ScatterplotMatrix(data, columns, dependentVariable, dependentVariableName,
pointSize, alphaPoint, colours)
|
data |
an object of class "data.frame" containing just numerical columns. |
columns |
an object of class "numeric" containing the list of columns that you want in your scatterplot. |
dependentVariable |
an object of class "numeric", "factor" or "integer" is a list of values containig the dependent variable. |
dependentVariableName |
is an optional parameter. It's an string that contains the name of your dependent variable. |
pointSize |
is an optional parameter of class numeric with a single value that represent the point size of plot. |
alphaPoint |
is an optional parameter of class numeric with a single value that represent the alpha of points in the plot. |
colours |
is an optional parameter of class character with a list of colours to use in the plot. The default value for continuos dependent variable is c("darkred", "yellow", "darkgreen") and for categorical dependent variable are the default colours defined by ggplot. |
https://gastonsanchez.wordpress.com/2012/08/27/scatterplot-matrices-with-ggplot/
makePairs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #Example 1
iris.x <- iris[,1:4] # These are the independent variables
Species <- iris[,5] # This is the dependent variable
# A Scatterplot of all columns
ScatterplotMatrix(iris.x, c(1,2,3,4), Species, "Species")
# A Scatterplot of somes columns and different point size and alpha point
ScatterplotMatrix(iris.x, c(2,4), Species, "Species", 2, 1)
# A Scatterplot with a different colours palette
myPalette <- c("darkolivegreen4", "goldenrod1", "dodgerblue4")
ScatterplotMatrix(iris.x, c(2,4), Species, "Species", 2, 1, colours = myPalette)
#Example 2
# Getting a clean data set (without missing values)
cars <- read.csv("https://dl.dropboxusercontent.com/u/12599702/autosclean.csv", sep = ";", dec = ",")
cars.x <- cars[,1:16] # These are the independent variables
cars.y <- cars[,17] # This is the dependent variable
# A Scatterplot of some columns
ScatterplotMatrix(cars.x, seq(3, 8, 1), cars.y, "Price")
# A Scatterplot of somes columns and different point size and alpha point
ScatterplotMatrix(cars.x, c(2,4), cars.y, "Price", 2, 1)
# A Scatterplot with a different colours palette
myPalette <- c("darkolivegreen4", "goldenrod1", "dodgerblue4")
ScatterplotMatrix(cars.x, c(2,4), cars.y, "Price", 1.5, 1, colours = myPalette)
#Example 3
# Getting a clean data set (without missing values)
cars <- read.csv("https://dl.dropboxusercontent.com/u/12599702/autosclean.csv", sep = ";", dec = ",")
cars.x <- cars[,1:16] # These are the independent variables
cars.y <- cars[,17] # This is the dependent variable
# Performing prcomp
cars.pca <- prcomp(cars.x, center = TRUE, scale. = TRUE)
# A Scatterplot of some columns of principal components
ScatterplotMatrix(as.data.frame(cars.pca$x), seq(1, 4, 1), cars.y, "Price")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.