For this question, a subset of the tables contained in the History of Baseball database are available. Additional details are available here: https://www.kaggle.com/seanlahman/the-history-of-baseball. The following tables will be used for these questions:
library(readr)
library(dplyr)
library(knitr)
library(tidyr)
player <- read_csv("http://math.montana.edu/ahoegh/teaching/stat408/datasets/player.csv")
all_star <- read_csv("http://math.montana.edu/ahoegh/teaching/stat408/datasets/all_star.csv")
salary <- read_csv("http://math.montana.edu/ahoegh/teaching/stat408/datasets/salary.csv")
How many players were born in Montana.
Print a table that contains each player born in Montana. The table should contain the player_id as well as given name and their total salary across all years. If salary is not available (pre-1985), include the player but have an NA for salary.
Create a thin dataset for that contains the yearly salaries of David Ortiz, Derek Jeter, and Troy Tulowitzki.
Create a wide dataset for that contains the salaries of David Ortiz, Derek Jeter, and Troy Tulowitzki.
Which player(s) made the most appearances as an all star representing the National League (NL)?