Question: The starter code below loads the tidyverse and the Lahman package. As a result, you have access to objects named: AllstarFull Batting People Salaries Teams
The starter code below loads the tidyverse and the Lahman package. As a result, you have access to objects named:
AllstarFull
Batting
People
Salaries
Teams
TeamsFranchises
Consider reading the documentation of these objects.
Wrangle the data made availabe by the Lahman package to create a tibble named seasonba with elements:
playerID
nameFirst
namelast
yearID
H
BA
Each row of this data should contain measurements related to an MLB player batter's single season statistics. Only include rows corresponding to the season and after for batters that had at least atbats in a season. The columns playerID, namefirst, nameLast are the player's identifier, first name, and last name respectively. The year ID column is the year of the season. The columns and BA are the number of hits, number of at bats, and the batting average for a player's season. The batting average should be rounded to three digits. The rows should be arranged from highest to lowest batting average, with ties broken first by year, then by last name.
Done correctly, the first row should be Tony Gwynns season. Baseball fans will be quick to notice that this list does not include Teddy Ballgame's season where he averaged but we are exluding preintegration seasons.
submission.R
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
