data() iris dim(iris) names(iris) ?iris plot(iris) pi pi = 4 pi rm(pi) pi iris[,1] = 0 iris rm(iris) irs iris head(iris[,c(1,2,3,4)]) head(iris[,1:4]) head(iris[,-5]) names(iris) head(iris[7:12,c(1,2,3,4)]) tail(iris[7:12,c(1,2,3,4)]) tail(iris[,c(1,2,3,4)]) iris[50:56,"Petal.Length"] iris[50:56,c("Petal.Length","Sepal.Width")] names(iris) names(iris) = c("sl","sw","pl","pw") head(iris) names(iris) = c("sl","sw","pl","pw","spec") head(iris) iris[c(45,78,98),c("sw","sl")] sw attach(iris) sw range(sw) iris[ sw>4 , ] iris[ sw>4 , 'spec'] detach(iris) sw sw = 4 attach(iris) sw rm(sw) sw detach(iris) A = matrix(1:20,5,4) A x = A[,1] y = A[1,] A[x >= 3, y < 10 ] A[A>10] A>10 x>=3 y<10 pairs(iris) pairs(iris[,-5]) pairs(iris[,-5],col=iris[,5]) library(rgl) options(rgl.printRglwidget = TRUE) plot3d(iris[,1:3]) plot3d(iris[,1:3],ty='s') plot3d(iris[,1:3],ty='s',size=1) col = rep(c('red','green','blue'),c(50,50,50)) col plot3d(iris[,1:3],ty='s',size=1,col=col) library(aplpack) faces(iris[,-5]) faces(iris[sample(150,20),-5]) ?faces data() sunspot.year ?sunspot.year plot(sunspot.year, ty='l') length(sunspot.year) A =matrix(1:290,29) A x[A[,1]] x[A[1,]] A[1,] A =matrix(1:290,10,29) A[1,] A[,1] x[A[,1]] x[A[,2]] for(i in 1:29) print(max(x[A[,i]])) plot(sunspot.year, ty='p') data() ?quakes dim(quakes) names(quake) names(quakes) head(quakes) plot(quakes[,-5])