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

Thursday, September 5, 2019

Codecademy Variance in R Distance From Mean 2/6


#Sample Solution
---
title: "Variance in R"
output: html_notebook
---
```{r message=FALSE, warning=FALSE}
# load data
grades <- c(88, 82, 85, 84, 90)
mean <- mean(grades)

#Change these five variables
difference_one <- 88 - mean
difference_two <- 82 - mean
difference_three <- 85 - mean
difference_four <- 84 - mean
difference_five <- 90 - mean

print(paste("The mean of the data set is ", mean))

print(paste("The first student is", round(difference_one, digits=2) , "percentage points away from the mean."))
print(paste("The second student is ", round(difference_two, digits=2) , "percentage points away from the mean."))
print(paste("The third student is",round(difference_three, digits=2) , "percentage points away from the mean."))
print(paste("The fourth student is",round(difference_four, digits=2) , "percentage points away from the mean."))
print(paste("The fifth student is",round(difference_five, digits=2) , "percentage points away from the mean."))
```

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts