This repository was archived by the owner on Feb 6, 2020. It is now read-only.
forked from riffomonas/make_tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbaby_name_analysis.bash
More file actions
39 lines (32 loc) · 1.44 KB
/
baby_name_analysis.bash
File metadata and controls
39 lines (32 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
# Prepare annual baby name data report.
# Assumes:
# * the user is connected to the internet
# * has R installed in their PATH
# * has rmarkdown package installed
# Depends on: website data at https://www.ssa.gov/oact/babynames/names.zip
# Produces: slew of files named yob????.txt and a pdf file
curl -Lo data/raw/names.zip https://www.ssa.gov/oact/babynames/names.zip
unzip -u -d data/raw/ data/raw/names.zip
# Concatenate the annual baby name data
# Depends on: data/raw/yob????.txt files
# code/concatenate_files.R
# Producees: data/processed/all_names.csv
R -e "source('code/concatenate_files.R')"
# Fills in missing data from annual survivorship data
# Depends on: data/raw/alive_2016_per_100k.csv
# code/interpolate_mortality.R
# Produces: data/processed/alive_2016_annual.csv
R -e "source('code/interpolate_mortality.R')"
# Generate counts of total and living people with each name
# Depends on: data/processed/alive_2016_annual.csv
# data/processed/all_names.csv
# code/get_total_and_living_name_counts.R
# Produces: data/processed/total_and_living_name_counts.csv
R -e "source('code/get_total_and_living_name_counts.R')"
# Renders an Rmarkdown file that creates various plots and
# provides an entertaining color commentary
# Depends on: data/processed/total_and_living_name_counts.csv
# code/plot_functions.R
# Produces: family_report.html
R -e "library(rmarkdown); render('family_report.Rmd')"