#Sample Solution
---
title: "Quartiles"
output: html_notebook
---
```{r}
# load song data
load("songs.Rda")
songs
```
```{r}
# create the variables songs_q1, songs_q2, and songs_q3 here:
songs_q1 <- quantile(songs, 0.25)
songs_q2 <- quantile(songs, 0.50)
songs_q3 <- quantile(songs, 0.75)
```
```{r}
# create the variables favorite_song and quarter here:
favorite_song <- 209.13587
quarter <- 2
```
```{r}
# ignore the code below here:
tryCatch(print(paste("The first quartile of dataset one is",songs_q1)), error=function(e) {print("You haven't defined songs_q1")})
tryCatch(print(paste("The second quartile of dataset two is",songs_q2)), error=function(e) {print("You haven't defined songs_q2")})
tryCatch(print(paste("The third quartile of dataset one is",songs_q3)), error=function(e) {print("You haven't defined songs_q3")})
```
No comments:
Post a Comment