1a
(5*4)^(4*5)-56
## [1] 1.048576e+26
1b
23-1*(8-12)
## [1] 27
1c
56/8*(3+4)
## [1] 49
1d
45-5*8+(8+9)
## [1] 22
2a
a <- c(2, 5, 6, 7)
a
## [1] 2 5 6 7
2b
b <- c(1, 0, 9, 8)
b
## [1] 1 0 9 8
2c
c <- c(6, 5, 8, 3)
c
## [1] 6 5 8 3
Matrix
matrix_Z <- matrix(c(a, b, c), byrow = TRUE, nrow = 3)
matrix_Z
## [,1] [,2] [,3] [,4]
## [1,] 2 5 6 7
## [2,] 1 0 9 8
## [3,] 6 5 8 3
Column & Row Titles
Column_title <- c("Mon", "Tue", "Wed", "Thu")
Row_title <- c("Present", "Absent", "On Leave")
colnames(matrix_Z) <- Column_title
rownames(matrix_Z) <- Row_title
matrix_Z
## Mon Tue Wed Thu
## Present 2 5 6 7
## Absent 1 0 9 8
## On Leave 6 5 8 3
Column & Row sums
rowSums(matrix_Z)
## Present Absent On Leave
## 20 18 22
colSums(matrix_Z)
## Mon Tue Wed Thu
## 9 10 23 18