Название | Sports Analytics in Practice with R |
---|---|
Автор произведения | Ted Kwartler |
Жанр | Медицина |
Серия | |
Издательство | Медицина |
Год выпуска | 0 |
isbn | 9781119598091 |
Exercises
1 How is an IDE different than a coding language?
2 Describe the difference between a vector and a data frame or matrix?What is the difference between a data frame and matrix?
3 Construct a vector called `position` where the values are:“Center,” “Forward,” “Guard,” “Forward,” “Forward,” and “Guard.”Change the object type from character as it was constructed into a factor.Tabulate the `position` factor object using `table` in a new object called `tallyPosition`.Use a new function to quickly create a bar plot of the results. To do so, apply `barplot` on the ` tallyPosition` object.
4 Load ` library(RCurl) ` then create an object called “bostonStats” by loading the file here: https://raw.githubusercontent.com/kwartler/Practical_Sports_Analytics/main/C1_Data/2019-2020%20Boston%20Player%20Stats.csvHow many rows does this data frame have?How many columns does this data frame have?Examine the last 4 rows of the data programmatically? What player is listed as the fourth from the bottom?Using either indexing or column name, get summary statistics for the `GP_games_played` column. What is the third quartile of this statistic?
5 Load ` library(ggplot2) ` then create a quick plot of ` STEALS_PER_GAME` and ` TURNOVERS_PER_GAME`. Does there appear to be a relationship to the syle of play for strong defense and turnovers?
6 Load `library(tidyr)`, then create a heatmap of the Boston team data using ` REBOUNDS_PER_GAME`, ` ASSISTS_PER_GAME`, ` STEALS_PER_GAME`, and `BLOCKS_PER_GAME` by ` ï.PLAYER`Create a small data frame renaming the player column.Pivot the data frame.Create a `ggplot` visual with the pivoted data where` aes(x = stat, y = player, fill = value)`The chart type is `geom_tile()`The color intensity scales from “lightgreen” to “darkred”The x-axis label “Basketball Statistics”
Конец ознакомительного фрагмента.
Текст предоставлен ООО «ЛитРес».
Прочитайте эту книгу целиком, купив полную легальную версию на ЛитРес.
Безопасно оплатить книгу можно банковской картой Visa, MasterCard, Maestro, со счета мобильного телефона, с платежного терминала, в салоне МТС или Связной, через PayPal, WebMoney, Яндекс.Деньги, QIWI Кошелек, бонусными картами или другим удобным Вам способом.