I would like you to complete the following basic operations in R but first think about the meaning of the mathematical operations you are executing. As analysts, I would like you to understand first the task you are being asked to complete.
log(5)
log(10)
ln(9)
log(5)
## [1] 1.609438
log10(10)
## [1] 1
log10(5)
## [1] 0.69897
log10(20)
## [1] 1.30103
log(20)#ln
## [1] 2.995732
#ln(2)
log(2)
## [1] 0.6931472
#In short, the actual log that R and other software tools always compute is not log(base 10)(log is normally a log function of base 10)but instead log(base e)(ln). Every time we are asked to computed mathematically log(any number or expression)=log10(number or expressions). On other hand, in order to calculate the real value for any operation ln(number or expression); just enter log(number or expression)
log
## function (x, base = exp(1)) .Primitive("log")
x1<-c(1,2,3,4,5)
x2<-c(0,2,4,4,6)
#What is x1+x2?
x1+x2
## [1] 1 4 7 8 11
#What is x1-x2?
x1-x2
## [1] 1 0 -1 0 -1
#What is x1*x2?
x1*x2
## [1] 0 4 12 16 30
x1==x2
## [1] FALSE TRUE FALSE TRUE FALSE
survey<-c("Yes","No", "Yes", "Yes", "Yes", "Yes", "No", "No", "No","Yes","No","Yes", "No", "No","Yes")
table(survey)
## survey
## No Yes
## 7 8
infections<-c(11,20,29,32,55,72,10,9)
#Please find the min,mean,median,and the max
summary(infections)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 9.00 10.75 24.50 29.75 37.75 72.00
#find the sd
sd(infections)
## [1] 22.9767