Question
Use R Define two new variables in the `Teams` data frame from the `Lahman` package: batting average(BA) and slugging percentage(SLG). Batting average is the ratio
Use R
Define two new variables in the `Teams` data frame from the `Lahman` package: batting average(BA) and slugging percentage(SLG). Batting average is the ratio of hits (H) to at-bats (AB), and slugging percentage is the total bases divided by at-bats. To compute total bases, you get 1 for a single, 2 for a double, 3 for a triple, and 4 for a home run.
Note: Make sure to upload your code, explanation your code, and the plot in every questions.
1. Plot a time series of SLG since 1954 conditioned by `lgID`.
2. Is slugging percentage typically higher in the American League (AL) or the national league (NL)?
3. Can you think of why this might be the case?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started