9
pi
100 %% 5
100 %% 7
4 : 10
5 : -5
1 / 0
0 / 0
-1 / 0
All together :
vector = c(11, 42, 93, 77, 15, 69, 27, 98, 9, 160)
vector
vector[5]
class(vector)
min(vector)
max(vector)
length(vector)
vector_2 = c("a", "b", "c", "d", "e")
vector_2
All together
num = c(10, 20, 30, 40, 50)
num < 20 | num > 40
all (num > 0)
any (num > 20)
sqrt(81)
sqrt(-1)
sqrt(-1 + 0i)
sqrt(as.complex(-10))
x < 10
x
x = x + 20
a = c(1, 2, 3, 4)
b = c(5, 6, 7, 8)
a + b
a*b
a - b
b%%a
b/a
a^2
d = list(1, 2, 3, 4)
help(list)
Matrix = matrix(c(1, 3, 5, 7, 9, 11, 13, 15, 17), nrow = 3, ncol = 3, byrow = TRUE)
Matrix[2,] #display 2nd row
Matrix[,3] #display 3rd column
Matrix[1,3] #display 1st row and 3rd column
Matrix[, c(1, 2)] #display 1st and 2nd column only
t(Matrix) #Transpose of Matrix
Matrix_2 = matrix(c(10, 20, 30, 40, 50, 60), nrow = 3, ncol = 2, byrow = FALSE)
Matrix_3 = matrix(c(70, 80, 90), nrow = 3, ncol = 1)
Matrix_4 = cbind(Matrix_2, Matrix_3)
All Together