这个作业是用R语言根据数据库的记录回答相应的问题

Homework 3
Statistics 141B 2020

下面有很多问题。您不必全部回答。您需要完成
13个问题。您可以做更多的问题,并获得相应的加分。
与往常一样,我们鼓励您提出自己的问题并加以探讨。陈述这样的问题
清楚地指出为什么会有趣。然后探索数据并解释您的发现,
提供理由和代码。
在SQL中进行尽可能多的计算,然后将结果表返回到R以完成
计算。并不是所有的问题都可以直接在SQL中直接(轻松)回答。
给出答案并显示用于回答每个问题的SQL和R代码。
有一些奖励积分可用于验证R中的相同计算,以使用
表直接导入到R中。
1.数据涵盖哪些年份?这些年来每年都有数据吗?
2.数据库中包含多少个(唯一的)人员?球员,经理等有多少?
3.?有多少人成为经理?
4.从2000年到2013年,每年有多少人?所有团队都一样吗
玩家人数?
5.哪支球队在2010年赢得了世界大赛冠军?包括球队名称,联赛和分区。
6.每年哪支球队输掉了世界大赛?再次,注明球队名称,联赛和
师。
7.再次以团队,联赛的名称计算所有年份的世界大赛获胜者表
和分裂。
8.再次以团队,联赛的名称计算所有年份的世界大赛获胜者表
和分裂。
9.您是否看到一个赛季赢得的比赛次数与赢得世界比赛之间的关系
系列?
10. 2003年,三项最高薪水是多少? (我们在这里指的是独特的薪水,即
就是几名获得完全相同金额的球员。)找到获得这三项薪水中的任何一项的球员
他们的所有细节?
11.对于2010年,计算每个不同团队的总工资。接下来计算团队
我们拥有其工资信息的数据库中所有年份的工资单。在图中显示这些。
12.探索工资随时间的变化。使用情节。确定赢得世界冠军的球队
系列或联赛。工资与赢得联赛和/或世界大赛有何关系。
13. Compare payrolls for the teams that are in the same leagues, and then in the same divisions.
Are there any interesting characteristics? Have certain teams always had top payrolls over the
years? Is there a connection between payroll and performance?
14. Which player has hit the most home runs? Show the number per year.
15. Has the distribution of home runs for players increased over the years?
16. Do players who hit more home runs receive higher salaries?
17. Are certain baseball parks better for hitting home runs?
18. What’s the distribution of double plays? triple plays?
19. What pitchers have a large number of double or triple plays? Again, give their details (names,
team, year, …).
2
20. How many games do pitchers start in a season? Plot this against games finished in a season.
21. How many games do pitchers win in a season?
22. How are wins related to hits, strikeouts, walks, homeruns and earned runs?
23. What are the top ten collegiate producers of major league baseball players? How many colleges
are represented in the database?
24. What players have pitched in the post season and also hit a home run in their career?
When answering the questions, try to summarize the results in convenient and informative form
(e.g. tables and/or plots) that illustrate the key features.