Max Wallace
We need to load tidyverse.
{r} install.packages("tidyverse")
{r} library(tidyverse)
Imported our class playlist data
{r} df <- read_csv("Playlist - Clean.csv")
Named the csv df
{r} head(df)
{r} df$genre <- as.factor(df$Genre)
After my data was loaded in, I counted how many songs were in each
genre
{r} df %>% count(genre)
{r} genre_counts <-df %>% count(genre) head(genre_counts)
{r} genre_counts<-genre_counts %>% mutate(tprob=n/sum(n)) genre_counts
Next I calculated the theoretical probablilty by creating a new
coulmn named tprob and using the mutate function.
```{r} genre_counts\(tprob
<-round(genre_counts\)tprob,2) genre_counts
```
Last I rounded my TPROB numbers to two decimal places so they were
easier to interperet and read.
The table shows me that there is a 33% chance of getting a Hip
Hop/Rap song, 14% chance of getting a Pop/Kpop/Latin song, 3% of getting
a House/Ska song, 8% chance for RnB/Soul song, 26% chance for
alt/indie/folk and 16% chance of getting a country/rock song.