Assignment 01

#Problem 1 : Calculations (a)

(5*4)^(4*5)-56
## [1] 1.048576e+26

#Problem 1 : Calculations (b)

23-1*(8-12)
## [1] 27

#Problem 1 : Calculations (c)

56/8*(3+4)
## [1] 49

#Problem 1 : Calculations (d)

45-5*8+(8+9)
## [1] 22

#Problem 2 : Creating Vectors a,b,c

a<-c(2,5,6,7)
b<-c(1,0,9,8)
c<-c(6,5,8,3)

#Rowbind the vectors to form a 3X4 matrix.

mat_nabeeha <- rbind(a, b, c)
print(mat_nabeeha)
##   [,1] [,2] [,3] [,4]
## a    2    5    6    7
## b    1    0    9    8
## c    6    5    8    3

#Change the column names to (Mon, Tue, Wed, Thu). #Change the row names to (Present, Absent, On leave).

colnames(mat_nabeeha)<-c("Mon", "Tue", "Wed", "Thu")
rownames(mat_nabeeha)<-c('Present', 'Absent', 'On leave')

print(mat_nabeeha)
##          Mon Tue Wed Thu
## Present    2   5   6   7
## Absent     1   0   9   8
## On leave   6   5   8   3

#Calculate the rowsums and the columnsums.

row_sums<-rowSums(mat_nabeeha)
row_sums
##  Present   Absent On leave 
##       20       18       22
col_sums<-colSums(mat_nabeeha)
col_sums
## Mon Tue Wed Thu 
##   9  10  23  18