Answer 1a:
(5*4)^(4*5)-56
## [1] 1.048576e+26
Answer 1b:
23-1*(8-12)
## [1] 27
Answer 1c:
56/8*(3+4)
## [1] 49
Answer 1d:
45-5*8+(8+9)
## [1] 22
Answer 2a:
a <- c(2,5,6,7)
a
## [1] 2 5 6 7
Answer 2b:
b <- c(1,0,9,8)
b
## [1] 1 0 9 8
Answer 2c:
c <- c(6,5,8,3)
c
## [1] 6 5 8 3
Matrix:
Attendance <- rbind(a,b,c)
Attendance
## [,1] [,2] [,3] [,4]
## a 2 5 6 7
## b 1 0 9 8
## c 6 5 8 3
colnames(Attendance) <- c("Mon", "Tue", "Wed", "Thu")
rownames(Attendance) <- c("Present", "Absent", "On leave")
Attendance
## Mon Tue Wed Thu
## Present 2 5 6 7
## Absent 1 0 9 8
## On leave 6 5 8 3
Sum_of_rows <- rowSums(Attendance)
Sum_of_rows
## Present Absent On leave
## 20 18 22
Sum_of_columns <- colSums(Attendance)
Sum_of_columns
## Mon Tue Wed Thu
## 9 10 23 18