(5*4)^(4*5)-56
## [1] 1.048576e+26
23-1*(8-12)
## [1] 27
56/8*(3+4)
## [1] 49
45-5*8+(8+9)
## [1] 22
#The Vector
vectorA <- c(2,5,6,7)
vectorB <- c(1,0,9,8)
vectorC <- c(6, 5, 8, 3)
#the matrix by row binding the vectors
attendence_matrix <- rbind(vectorA, vectorB, vectorC)
#setting the column names
colnames(attendence_matrix) <- c("Mon", "Tue", "Wed", "Thu")
#seting the row name
rownames(attendence_matrix) <- c("Present", "Absent", "On leave")
#print the matrix
print(attendence_matrix)
## Mon Tue Wed Thu
## Present 2 5 6 7
## Absent 1 0 9 8
## On leave 6 5 8 3
#calculate rowsums
row_sums <- rowSums(attendence_matrix)
print(row_sums)
## Present Absent On leave
## 20 18 22
#calculate coulmn sums
col_sums <- colSums(attendence_matrix)
print(col_sums)
## Mon Tue Wed Thu
## 9 10 23 18