Plot3D: Plot PC 3D (3DPlot)

Description Usage Arguments Examples

View source: R/Plots.R

Description

Generate a 3D plot Generates a 3D graphic for a set of 3 columns of the data set.

Usage

1
Plot3D(data, columns, dependentVariable)

Arguments

data

an object of class data frame with the data.

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.

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
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

# 3D Plot of 3 first columns of data set
Plot3D(iris.x, c(1,2,3), Species)


#Example 2
iris.x <- iris[,1:4] # These are the independent variables
Species <- iris[,5] # This is the dependent variable

ir.pca <- prcomp(iris.x, center = TRUE, scale. = TRUE) # performin prcomp

# 3D Plot of 3 first columns of data set
Plot3D(as.data.frame(ir.pca$x), c(1,2,3), Species)


#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

# 3D Plot of 3 first columns of data set
Plot3D(cars.x, c(1,2,3), cars.y)


#Example 4
# 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

cars.pca <- prcomp(cars.x, center = TRUE, scale. = TRUE) # performin prcomp

# 3D Plot of 3 first columns of data set
Plot3D(as.data.frame(cars.pca$x), c(1,2,3), cars.y)

mariytu/RegressionLibs documentation built on May 21, 2019, 11:47 a.m.