#Sample Solution
---
title: "Standard Deviation"
output: html_notebook
---
```{r message=FALSE, warning=FALSE}
# load libraries
library(dplyr)
library(tidyr)
```
```{r}
# Importing data and calculating variance
load("lesson_data.Rda")
variance <- function(x) mean((x-mean(x))^2)
nba_variance <- variance(nba_data)
okcupid_variance <- variance(okcupid_data)
```
```{r}
# Change these variables to be the standard deviation of each dataset.
nba_standard_deviation <- nba_variance ^ 0.5
okcupid_standard_deviation <- okcupid_variance ^ 0.5
#IGNORE CODE BELOW HERE
print(paste("The standard deviation of the NBA dataset is ",nba_standard_deviation))
print(paste("The standard deviation of the OkCupid dataset is ", okcupid_standard_deviation))
```
No comments:
Post a Comment