# The MIT License # Copyright (c) 2007 The GGobi Foundation # http://www.ggobi.org/book/code-license.txt # Read in data d.flea <- read.csv("flea.csv") attach(d.flea) # Load libraries library(rggobi) # Load data into ggobi and set up colors/glyphs gg <- ggobi(d.flea) g <- gg[1] species_to_type <- c("Concinna" = 4, "Heptapot." = 6, "Heikert." = 3) species_to_color <- c("Concinna" = 5, "Heptapot." = 1, "Heikert." = 6) glyph_type(g) <- species_to_type[species] glyph_size(g) <- 3 glyph_color(g) <- species_to_color[species] # Run projection pursuit on sphered data in GGobi, # using LDA index # Now scramble the species labels for (i in 1:8) { pspecies <- sample(species) glyph_color(g) <- species_to_color[pspecies] glyph_type(g) <- species_to_type[pspecies] readline() } # And run projection pursuit again # A non-structure example x <- matrix(rnorm(74*50),ncol=50) colnames(x) <- paste("V",1:50,sep="") gg <- ggobi(x) g <- gg[1] glyph_type(g) <- species_to_type[species] glyph_size(g) <- 3 glyph_color(g) <- species_to_color[species] for (i in 1:8) { pspecies <- sample(species) glyph_color(g) <- species_to_color[pspecies] glyph_type(g) <- species_to_type[pspecies] readline() }