The R Project SVN R

Rev

Rev 88581 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 88581 Rev 88990
Line 129... Line 129...
129
text(cbind(2.5, 2*c(1,3,5)-.4), lends, col= 1:3, cex = 1.5)
129
text(cbind(2.5, 2*c(1,3,5)-.4), lends, col= 1:3, cex = 1.5)
130
 
130
 
131
table(iris$Species) # is data.frame with 'Species' factor
131
table(iris$Species) # is data.frame with 'Species' factor
132
iS <- iris$Species == "setosa"
132
iS <- iris$Species == "setosa"
133
iV <- iris$Species == "versicolor"
133
iV <- iris$Species == "versicolor"
-
 
134
PS <- c("Petal", "Sepal") ; clr <- c(2,4)
-
 
135
psL <- paste(PS, "Length",sep="."); Sps <- paste0("    Setosa ", PS, "s")
-
 
136
psW <- paste(PS, "Width", sep="."); Vps <- paste0("Versicolor ", PS, "s")
134
op <- par(bg = "bisque")
137
op <- par(bg = "bisque")
135
matplot(c(1, 8), c(0, 4.5), type =  "n", xlab = "Length", ylab = "Width",
138
matplot(c(1, 8), c(0, 4.5), type =  "n", xlab = "Length", ylab = "Width",
136
        main = "Petal and Sepal Dimensions in Iris Blossoms")
139
        main = "Petal and Sepal Dimensions in Iris Blossoms")
137
matpoints(iris[iS,c(1,3)], iris[iS,c(2,4)], pch = "sS", col = c(2,4))
140
matpoints(iris[iS, psL], iris[iS, psW], pch = "sS", col = clr)
138
matpoints(iris[iV,c(1,3)], iris[iV,c(2,4)], pch = "vV", col = c(2,4))
141
matpoints(iris[iV, psL], iris[iV, psW], pch = "vV", col = clr)
139
legend(1, 4, c("    Setosa Petals", "    Setosa Sepals",
142
legend(1, 4,    c(Sps, Vps),          pch = "sSvV", col = clr)
140
               "Versicolor Petals", "Versicolor Sepals"),
-
 
141
       pch = "sSvV", col = rep(c(2,4), 2))
-
 
142
 
143
 
143
matplot(iris3[, "Petal L.",], iris3[, "Petal W.",], pch = "SCV",
144
matplot(iris3[, "Petal L.",], iris3[, "Petal W.",], pch = "SCV",
144
        col = rainbow(3, start = 0.8, end = 0.1),
145
        col = rainbow(3, start = 0.8, end = 0.1),
145
        sub = paste(c("S", "C", "V"), dimnames(iris3)[[3]],
146
        sub = paste(c("S", "C", "V"), dimnames(iris3)[[3]],
146
                    sep = "=", collapse= ",  "),
147
                    sep = "=", collapse= ",  "),