# Calculation 1A:
result1 <- (5*4)^(4*5)-56
# Calculation 1B:
result2 <- 23-1*(8-12)
# Calculation 1C:
result3 <- 56/8*(3+4)
# Calculation 1D:
result4 <- 45-5*8+(8+9)
# Display the results
result1
## [1] 1.048576e+26
result2
## [1] 27
result3
## [1] 49
result4
## [1] 22
# Create the vectors a, b, c
a <- c(2, 5, 6, 7)
b <- c(1, 0, 9, 8)
c <- c(6, 5, 8, 3)
# Row-bind the vectors to form a 3x4 matrix
matrix_data <- rbind(a, b, c)
# Convert the matrix to a data frame and set row and column names
df <- as.data.frame(matrix_data)
colnames(df) <- c("Mon", "Tue", "Wed", "Thu")
rownames(df) <- c("Present", "Absent", "On leave")
# Calculate the row sums and column sums
row_sums <- rowSums(df)
column_sums <- colSums(df)
# Print the matrix, row sums, and column sums
print(df)
## Mon Tue Wed Thu
## Present 2 5 6 7
## Absent 1 0 9 8
## On leave 6 5 8 3
print("Row Sums:")
## [1] "Row Sums:"
print(row_sums)
## Present Absent On leave
## 20 18 22
print("Column Sums:")
## [1] "Column Sums:"
print(column_sums)
## Mon Tue Wed Thu
## 9 10 23 18