-
-
Save codecademydev/2cf4b2a760e1ee5ca9aca84f2ed86802 to your computer and use it in GitHub Desktop.
Codecademy export
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Standard Deviation" | |
output: html_notebook | |
--- | |
```{r message=FALSE, warning=FALSE, error=TRUE} | |
library(readr) | |
library(dplyr) | |
``` | |
```{r error=TRUE} | |
load("project.Rda") | |
``` | |
```{r error=TRUE} | |
# Change these variables to be the standard deviation of each dataset. | |
# Inspect Data | |
head(london_data) | |
print (nrow(london_data)) | |
temp <- london_data$TemperatureC | |
# Variance and SD for the year | |
average_temp <- mean(temp) | |
print(average_temp) | |
temperature_var <- var (temp) | |
print(temperature_var) | |
temperature_standard_deviation <- sd(temp) | |
print(temperature_standard_deviation) | |
#Inspect once again | |
head(london_data) | |
tail(london_data) | |
# Get monthly temperature average | |
june <- london_data %>% | |
filter(month == '06') | |
june | |
july <- london_data %>% | |
filter(month == '07') | |
print(mean(june$TemperatureC)) | |
print(mean(july$TemperatureC)) | |
# Analyze by month | |
sd(june$TemperatureC) | |
sd(july$TemperatureC) | |
monthly_stats <- london_data %>% | |
group_by(month) %>% | |
summarise(mean= mean(temperatureC), standard_deviation = sd(temperatureC)) | |
print(monthly_stats) | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment