---
title: "Gun deaths"
date: 2017-02-01
output: html_document
---
```{r setup, include = FALSE}
library(tidyverse)
library(rcfss)
youth <- gun_deaths %>%
filter(age <= 65)
```
We have data about `r nrow(gun_deaths)` individuals killed by guns. Only `r nrow(gun_deaths) - nrow(youth)` are older than 65. The distribution of the remainder is shown below:
```{r youth-dist, echo = FALSE}
youth %>%
ggplot(aes(age)) +
geom_freqpoly(binwidth = 1)
```
---
s```
eval = FALSE
include = FALSE
echo = FALSE
message = FALSE
or warning = FALSE
results = 'hide'
error = TRUE
```{r raw_data}
rawdata <- readr::read_csv("a_very_large_file.csv")
```
```{r processed_data, cache = TRUE}
processed_data <- rawdata %>%
filter(!is.na(import_var)) %>%
mutate(new_variable = complicated_transformation(x, y, z))
```
```{r raw_data}
rawdata <- readr::read_csv("a_very_large_file.csv")
```
```{r processed_data, cache = TRUE, dependson = "raw_data"}
processed_data <- rawdata %>%
filter(!is.na(import_var)) %>%
mutate(new_variable = complicated_transformation(x, y, z))
```
knitr::opts_chunk$set(
echo = FALSE
)
We have data about
`r nrow(gun_deaths)`
individuals killed by guns. Only`r nrow(gun_deaths) - nrow(youth)`
are older than 65. The distribution of the remainder is shown below:
We have data about 100798 individuals killed by guns. Only 15687 are older than 65. The distribution of the remainder is shown below:
---
title: "Gun deaths"
author: "Benjamin Soltoff"
date: 2017-02-01
output: html_document
---
rmarkdown
renders your .Rmd
file---
title: "Untitled"
author: "Benjamin Soltoff"
date: "February 1, 2017"
output: html_document
---
---
title: "Untitled"
author: "Benjamin Soltoff"
date: "February 1, 2017"
output:
html_document:
toc: true
toc_depth: 2
---
title: "Untitled"
author: "Benjamin Soltoff"
date: "February 1, 2017"
output:
html_document:
theme: readable
highlight: pygments
---
theme
specifies the Bootstrap theme to use for the pagehighlight
specifies the syntax highlighting style for code chunks---
title: "Untitled"
author: "Benjamin Soltoff"
date: "February 1, 2017"
output:
html_document:
code_folding: hide
---
---
title: "Untitled"
author: "Benjamin Soltoff"
date: "February 1, 2017"
output:
html_document:
keep_md: true
---
---
title: "Gun deaths"
date: 2017-02-01
output: pdf_document
---
---
title: "Untitled"
author: "Benjamin Soltoff"
date: "February 1, 2017"
output:
pdf_document:
toc: true
toc_depth: 2
---
title: "Untitled"
author: "Benjamin Soltoff"
date: "February 1, 2017"
output:
pdf_document:
highlight: pygments
---
---
title: "Untitled"
author: "Benjamin Soltoff"
date: "February 1, 2017"
output: pdf_document
fontsize: 11pt
geometry: margin=1in
---
---
title: "Untitled"
author: "Benjamin Soltoff"
date: "February 1, 2017"
output:
pdf_document:
keep_tex: true
---
output:
html_document:
toc: true
toc_float: true
pdf_document: default
rmarkdown::render("my-document.Rmd",
output_format = "all")
# gun-deaths.R
# 2017-02-01
# Examine the distribution of age of victims in gun_deaths
# load packages
library(tidyverse)
library(rcfss)
# filter data for under 65
youth <- gun_deaths %>%
filter(age <= 65)
# number of individuals under 65 killed
nrow(gun_deaths) - nrow(youth)
# graph the distribution of youth
youth %>%
ggplot(aes(age)) +
geom_freqpoly(binwidth = 1)
It depends
source()
Rscript gun-deaths.R
Rscript -e "rmarkdown::render('gun-deaths.Rmd')"