Quotes help make search much faster. Example: "Practice Makes Perfect"

Saturday, September 7, 2019

Codecademy Interquartile Range Quartiles 2/4


#Sample Solution
---
title: "Interquartile Range"
output: html_notebook
---

```{r}
# load song data
load("songs.Rda")
```

```{r}
# find the first quartile
q1 <- quantile(songs,0.25)
```

```{r}
# calculate the third quartile here:
q3 <- quantile(songs,0.75)
```

```{r}
# calculate the interquartile range here:
interquartile_range <- q3 - q1
```

```{r}
# ignore the code below here:

tryCatch(print(paste("The first quartile of the dataset is",q1)), error=function(e) {print("You haven't defined q1 yet")})

tryCatch(print(paste("The third quartile of the dataset is",q3)), error=function(e) {print("You haven't defined q3 yet")})

tryCatch(print(paste("The IQR of the dataset is",interquartile_range)), error=function(e) {print("You haven't defined interquartile_range yet")})
```

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts