{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE)

R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

{r} install.packages("tidyverse") {r} library(tidyverse)

{r} df <- read_csv("Playlist - Playlist.csv")

```{r} gf <- df %>% count(Genre)

```{r}
print (gf)

{r} gf %>% mutate(probability = n/181) {r} mf <- read_csv("DS5 Table 1 - Sheet1.csv") {r} nf <- read_csv("DS5 Table 2 - Sheet1.csv") {r} of <- read_csv("DS5 Table 3 - Sheet1.csv") {r} lf <- read_csv("DS5 Table - Sheet1.csv") {r} xf <- mf %>% count(Genre) {r} yf <- nf %>% count(Genre) {r} zf <- of %>% count(Genre) {r} wf <- lf %>% count(Genre) {r} wf %>% mutate(probability = n/10) {r} xf %>% mutate(probability = n/14) {r} yf %>% mutate(probability = n/20) {r} zf %>% mutate(probability = n/30)

The probability of each song is 26% for Genre 1, 13% for Genre 2, 19% for Genre 4, 22% Genre 5, and 21% for Genre 6. While the random selection weighs more in one direction, looking at the objective data from the table, it is obvious that this is the case. I already knew about experimental and theoretical probability, but this really demonstrated how, despite the odds seeming like they should go one direction, there is no guarantee that the results will comply with the theoretical probability. This is demonstrated in the difference between the experimental and theoretical probability. I notice that the variability of genres of the experimental probability becomes more similar to the theoretical probability when the sample increases in size. This occurs because values cannot be selected multiple times, increasing the probability of the less chosen values, causing the numbers to gradually even out.

Reflection: It allowed me to simulate an actual playlist shuffle without having to listen to other people’s favorite songs, especially because I only have spotify free. You could also use simulations to see potential results for experiments or how genes might be transferred over generations. The most challenging code for me to write was the various tables as they were monotonous and prone to human error. I wasn’t really proud of any code. it wasn’t challenging much, if at all. I’d like to learn more about html coding. it would be very useful later on. I would try to be less tired while doing this. I don’t