R Markdown

Do the following calculations

  1. (54)^(45)-56
(5*4)**(4*5)-56
## [1] 1.048576e+26
  1. 23-1*(8-12)
23-1*(8-12)
## [1] 27
  1. 56/8*(3+4)
56/8*(3+4)
## [1] 49
  1. 45-5*8+(8+9)
45-5*8+(8+9)
## [1] 22
  1. Create the following vectors a, b, and c
  1. 2,5,6,7
a<-c(2,5,6,7)
  1. 1,0,9,8
b<-c(1,0,9,8)
  1. 6,5,8,3
c<-c(6,5,8,3)

Now,rowbinding to form 3X4 matrix

matrix<-rbind(a,b,c)
matrix
##   [,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)

colnames(matrix)<-c("Mon","Tue","Wed","Thu")
matrix
##   Mon Tue Wed Thu
## a   2   5   6   7
## b   1   0   9   8
## c   6   5   8   3

Change the row names to (Present, Absent, On leave)

rownames(matrix)<-c("Present","Absent","On leave")
matrix
##          Mon Tue Wed Thu
## Present    2   5   6   7
## Absent     1   0   9   8
## On leave   6   5   8   3

Rowsums

row<-rowSums(matrix)
row
##  Present   Absent On leave 
##       20       18       22

Columnsums

col<-colSums(matrix)
col
## Mon Tue Wed Thu 
##   9  10  23  18

END