This is an R Markdown Notebook. When you execute code within the notebook, the results appear beneath the code.

Try executing this chunk by clicking the Run button within the chunk or by placing your cursor inside it and pressing Ctrl+Shift+Enter.

plot(cars)

Add a new chunk by clicking the Insert Chunk button on the toolbar or by pressing Ctrl+Alt+I.

mean(cars$speed)
## [1] 15.4
mean(cars$dist)
## [1] 42.98
max(cars$dist)
## [1] 120
max(cars$speed)
## [1] 25
4+1
## [1] 5
5-2
## [1] 3
2^2
## [1] 4
sqrt(25)
## [1] 5
2^5
## [1] 32
log(2.72)#natural log of 2
## [1] 1.000632
log10(5)
## [1] 0.69897
log10(10)
## [1] 1
log10(100)
## [1] 2
#Here we are computing log base ten
log(10,base=5)
## [1] 1.430677
log(10,base=2)
## [1] 3.321928
log(1000,base=10)
## [1] 3

Question_1: Compute the log base 5 of 10 and the log of 10.

log(10,base=5)
## [1] 1.430677
log(10,base=10)
## [1] 1

Computing Offensive Metrics in Baseball

BA=(29)/(112)
BA
## [1] 0.2589286
Batting_Average=round(BA,digits = 3)
Batting_Average
## [1] 0.259