Sports Analytics in Practice with R. Ted Kwartler

Читать онлайн.
Название Sports Analytics in Practice with R
Автор произведения Ted Kwartler
Жанр Медицина
Серия
Издательство Медицина
Год выпуска 0
isbn 9781119598091



Скачать книгу

within R. Given that R is not picky about spacing and indentation, it is an excellent language for the novice programming. As you scale your learning in analytics and coding, you will likely want to add to your language toolkit.

      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 Кошелек, бонусными картами или другим удобным Вам способом.

/9j/4AAQSkZJRgABAQEBLAEsAAD/7SAUUGhvdG9zaG9wIDMuMAA4QklNBAQAAAAAAA8cAVoAAxsl RxwCAAACAAAAOEJJTQQlAAAAAAAQzc/6fajHvgkFcHaurwXDTjhCSU0EOgAAAAAA5QAAABAAAAAB AAAAAAALcHJpbnRPdXRwdXQAAAAFAAAAAFBzdFNib29sAQAAAABJbnRlZW51bQAAAABJbnRlAAAA AENscm0AAAAPcHJpbnRTaXh0ZWVuQml0Ym9vbAAAAAALcHJpbnRlck5hbWVURVhUAAAAAQAAAAAA D3ByaW50UHJvb2ZTZXR1cE9iamMAAAAMAFAAcgBvAG8AZgAgAFMAZQB0AHUAcAAAAAAACnByb29m U2V0dXAAAAABAAAAAEJsdG5lbnVtAAAADGJ1aWx0aW5Qcm9vZgAAAAlwcm9vZkNNWUsAOEJJTQQ7 AAAAAAItAAAAEAAAAAEAAAAAABJwcmludE91dHB1dE9wdGlvbnMAAAAXAAAAAENwdG5ib29sAAAA AABDbGJyYm9vbAAAAAAAUmdzTWJvb2wAAAAAAENybkNib29sAAAAAABDbnRDYm9vbAAAAAAATGJs c2Jvb2wAAAAAAE5ndHZib29sAAAAAABFbWxEYm9vbAAAAAAASW50cmJvb2wAAAAAAEJja2dPYmpj AAAAAQAAAAAAAFJHQkMAAAADAAAAAFJkICBkb3ViQG/gAAAAAAAAAAAAR3JuIGRvdWJAb+AAAAAA AAAAAABCbCAgZG91YkBv4AAAAAAAAAAAAEJyZFRVbnRGI1JsdAAAAAAAAAAAAAAAAEJsZCBVbnRG I1JsdAAAAAAAAAAAAAAAAFJzbHRVbnRGI1B4bEBywAAAAAAAAAAACnZlY3RvckRhdGFib29sAQAA AABQZ1BzZW51bQAAAABQZ1BzAAAAAFBnUEMAAAAATGVmdFVudEYjUmx0AAAAAAAAAAAAAAAAVG9w IFVudEYjUmx0AAAAAAAAAAAAAAAAU2NsIFVudEYjUHJjQFkA