Created
August 26, 2017 17:53
-
-
Save dggoldst/21789790dbf732821a9291c0bfd0f3a6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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: "Rain Per Day, Month, and Rainy Day in New York City" | |
author: "Dan Goldstein" | |
date: "August 26, 2017" | |
output: | |
html_document: default | |
pdf_document: default | |
word_document: default | |
--- | |
```{r setup, include=FALSE} | |
knitr::opts_chunk$set(echo = TRUE) | |
library(dplyr) | |
``` | |
```{r} | |
df = data.frame( | |
month = month.abb, | |
dayswrain = c(11, 10, 12, 11, 11, 10, 11, 10, 8, 8, 9, 10), | |
dayspermonth = c(31, 28.25, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31), | |
rainpermonth = c(3.9, 2.95, 4.06, 3.94, 4.45, 3.5, 4.53, 4.13, 3.98, 3.39, 3.82, 3.58) | |
) | |
df = df %>% mutate(rainperday = round(rainpermonth/dayspermonth,2), | |
rainperrainyday = round(rainpermonth/dayswrain,2) | |
) | |
``` | |
###What is the average rain per day and rain per rainy day in NYC? | |
```{r results=='asis'} | |
library(knitr) | |
kable( | |
df %>% summarise(mean_rainperday = round(mean(rainperday),2), | |
mean_rainperrainyday = round(mean(rainperrainyday),2)) | |
) | |
``` | |
###How do these vary by month? | |
```{r} | |
kable(df) | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment