ParallelPlot: Parallel Plot (Plot)

Description Usage Arguments Examples

View source: R/Plots.R

Description

Generate a plot of the columns of a data set for all or a range of instances. In some cases this is useful to identify some patron.

Usage

1
2
ParallelPlot(data, rows, columns, dependentVariable, dependentVariableName,
  lineSize, alphaLine, x_lab, colours)

Arguments

data

an object of class "data.frame" containing just numerical columns.

rows

an object of class "numeric" containing the list of rows that you want in your parallel plot.

columns

an object of class "numeric" containing the list of columns that you want in your parallel plot.

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.

lineSize

is an optional parameter of class numeric with a single value that represent the line size of plot.

alphaLine

is an optional parameter of class numeric with a single value that represent the alpha of lines in the plot.

x_lab

a boolean that represent if you want or not the x axis scale. In some cases, when you have many columns the plot could be ugly! The default value is False.

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.

Examples

 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
#Example 1
iris.x <- iris[,1:4] # These are the independent variables
Species <- iris[,5] # This is the dependent variable

# A ParallelPlot of all rows and all columns
ParallelPlot(iris.x, seq(1,nrow(iris.x),1), seq(1,ncol(iris.x),1), Species, "Species", 1, 0.5, TRUE)
# A ParallelPlot of all rows and some columns
ParallelPlot(iris.x, seq(1,nrow(iris.x),1), c(3,4), Species, "Species", 1, 0.5, TRUE)
# A ParallelPlot with a different colours palette
myPalette <- c("darkolivegreen4", "goldenrod1", "dodgerblue4")
ParallelPlot(iris.x, seq(1,nrow(iris.x),1), seq(1,ncol(iris.x),1), Species, "Species", 1, 0.5, TRUE, 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 ParallelPlot of all rows and all columns
ParallelPlot(cars.x, seq(1,nrow(cars.x),1), seq(1,ncol(cars.x),1), cars.y, "Price", 1, 0.5, TRUE)
# A ParallelPlot of all rows and some columns
ParallelPlot(cars.x, seq(1,nrow(cars.x),1), c(1,2,5,8,13,14), cars.y, "Price", 1, 0.8, TRUE)
# A ParallelPlot with a different colours palette
myPalette <- c("darkolivegreen4", "goldenrod1", "dodgerblue4")
ParallelPlot(cars.x, seq(1,nrow(cars.x),1), c(1,2,5,8,13,14), cars.y, "Price", 1, 0.8, TRUE, colours = myPalette)

mariytu/RegressionLibs documentation built on May 21, 2017, 6:49 p.m.