#load iris data
data(iris)
#Define grouping variable, grouping the observations by whether their species is
#Setosa or not
iris$group <- "setosa"
iris$group[iris$Species != "setosa"] <- "non-setosa"
iris$Species <- NULL
## Not run: ------------------------------------
# #make a PCADSC object, splitting the data by "group"
# irisPCADSC <- PCADSC(iris, "group")
#
# #make a partial PCADSC object from iris and fill out chromaInfo in the next call
# irisPCADSC2 <- PCADSC(iris, "group", doChroma = FALSE)
# irisPCADSC2 <- doChroma(irisPCADSC2)
#
# #make a chroma plot
# chromaPlot(irisPCADSC)
# chromaPlot(irisPCADSC)
#
# #Change the labels of the splitting variable
# chromaPlot(irisPCADSC, splitLabels = list("non-setosa" = "Not Setosa",
# "setosa" = "Setosa"))
#
# #Only plot components 1 and 4 and remove annotated variances
# chromaPlot(irisPCADSC, useComps = c(1,4), varAnnotation = "no")
#
# #Only plot the first components responsible for explaining 80 percent variance
# chromaPlot(irisPCADSC, cvCO = 0.8)
#
# #Change variable labels
# chromaPlot(irisPCADSC, varLabels = c("Sepal length", "Sepal width", "Petal length",
# "Petal width"))
## ---------------------------------------------
#Only do chroma information in order to get a faster runtime:
irisPCADSC_fast <- PCADSC(iris, "group", doCE = FALSE,
doAngle = FALSE)
chromaPlot(irisPCADSC_fast)
Run the code above in your browser using DataLab