1. Matrices

a <- c(1,1,1,2,2,2,3,3,3)
b <- matrix(a,nrow=3)
b
##      [,1] [,2] [,3]
## [1,]    1    2    3
## [2,]    1    2    3
## [3,]    1    2    3
x <- c(1,1,1,2,2,2,3,3,3)
y <- matrix(a, nrow=3, byrow=TRUE) # matrix class is a two-dimensional structure
y
##      [,1] [,2] [,3]
## [1,]    1    1    1
## [2,]    2    2    2
## [3,]    3    3    3
## 1.1 Indexing values in a matrix
b[1,1]
## [1] 1
b[1,]
## [1] 1 2 3
b[,1]
## [1] 1 1 1

2. Strings

a <- "Hello World"
b <- "You are so smart"
c <- "1"

class(a) # putting quotes around the characters to store as a string
## [1] "character"