c(2, 3, 5) length(c("aa", "bb", "cc", "dd", "ee")) n = c(2, 3, 5) s = c("aa", "bb", "cc", "dd", "ee") c(n, s) a = c(1, 3, 5, 7) b = c(1, 2, 4, 8) 5 * a a + b a - b a * b u = c(10, 20, 30) v = c(1, 2, 3, 4, 5, 6, 7, 8, 9) u + v a[0] a[1] b b[0] b[1] b b[-2] b[20] b[c(2, 3)] a a[c(1, 4)] a a[1:4] a[1:3] a[c(FALSE, TRUE, FALSE, TRUE)] v = c("Mary", "Sue") names(v) names(v) = c("First", "Last") names(v) v["First"] A = matrix( c(2, 4, 3, 1, 5, 7), nrow=2, ncol=3, byrow=TRUE) A A[1, 3] A[2,] A[, c(1, 3)] dimnames(A) = list( c("row1", "row2"), c("col1", "col2", "col3")) A A["row2", "col3"] B = matrix( c(2, 4, 3, 1, 5, 7), nrow=3, ncol=2) B t(B) C = matrix( c(7, 4, 2), nrow=3, ncol=1) C cbind(B, C) D = matrix( c(6, 2), nrow=1, ncol=2) D B BD = rbind(B, D) BD c(B) n = c(2, 3, 5) s = c("aa", "bb", "dd", "ee") b = c(TRUE, FALSE, TRUE, FALSE, FALSE) x = list(n, s, b, 3) x x[2] x[1] x[2] x[[2]] x[[2]][1] = "DORP" x[[2]] s v = list(bob=list("Bob", "Johnson", c(2, 3, 5)), john=list("John", "Smythe", c(1, 4, 6))) v v["bob"] v[["bob"]] v[["bob"]][[1]] v[["bob"]][[1]] = "Robert" v["bob"] v$bob v$john v$john[1] v$john[[1]] v$john[[1]] = "Johnny" v$john attach(v) bob detach(v) bob mtcars n = c(2, 3, 5) s = c("aa", "bb", "cc") b = c(TRUE, FALSE, TRUE) df = data.frame(n, s, b) mtcars["Mazda RX4", "mpg"] nrow(mtcars) ncol(mtcars) ncol(s) s B nrow(B) ncol(B) head(mtcars) q() s q()