Addition of three numbers
3+3+3
## [1] 9
Subtraction of one number from another
30-20
## [1] 10
Multiplication of two numbeers
30*2
## [1] 60
Division of one number by another
300/10
## [1] 30
Raise a numnber to the 4th power
3^4
## [1] 81
Cube root of a number
8^(1/3)
## [1] 2
Log 10 to anumber
log10(10)
## [1] 1
Assign c to a vector of six numbers
c<-c(1,2,3,4,5,6)
Print the third element of c
c[3]
## [1] 3
Length of vector c
c
## [1] 1 2 3 4 5 6
Assign d to a matrix row one 1,3,5,7 and row two 2,4,6,8
d= matrix ( c(1,2,3,4,5,6,7,8), nrow = 2, ncol = 4, byrow=)
d
## [,1] [,2] [,3] [,4]
## [1,] 1 3 5 7
## [2,] 2 4 6 8
Assign to F the addition of 5 to each element in d
F<-d+5
F
## [,1] [,2] [,3] [,4]
## [1,] 6 8 10 12
## [2,] 7 9 11 13
Assign k to 5.25 and m to “frank”"
k<-5.25
k
## [1] 5.25
m<-"frank"
m
## [1] "frank"
k and m data type
class(k)
## [1] "numeric"
class(m)
## [1] "character"
Assign p to the conversion of k to an interger
p<-as.integer(k)
p
## [1] 5
Assign G to the conversion of k to a character add 5.1 to G
G<- as.character(k)
When Trying to add G+5.1 Because k was converted to a character and assigned to G it is a non-numeric argument to binary operator. Cannot add numbers(5.1) and characters(G)