title | author | date | output |
---|---|---|---|
README |
Peter Ellis and Kay Fisher |
3 January 2017 |
html_document |
This project is for comparative analysis of international statistics on crime. It examines country-level data on homicide, assault, suicide; in the light of other variables such as Gross National Income, Human Development Index, economic inequality, and civilian firearm ownership.
This project has a GPL-3 license.
The ./integrate.R
script acts a bit like a make file. It creates all datasets from original source data, and performs all analysis and documentation that produce persistent artefacts. Any new analysis or data should be created with their own individual scripts which are then called with source()
from integrate.R
.
This README file is an README.md
markdown file that is built from README.Rmd
which is an Rmarkdown document. Don't edit the .md
file directly - edit the README.Rmd
file and rebuild it (with the knit()
command in integrate.R
).
The ./data/
folder contains only final, cleaned and concorded analysis-ready data sets, in either rda or csv format.
.rda
files should have a single data frame, with the same name as the*.rda
file itself.- Data that is a cross-sectional snapshot should have that reflected in the data.frame's name eg
indicators2005
. - hand-curated small datasets (eg concordances like
conc_iso3166.csv
) are ok but should be in csv format for easy tracking by Git and editing by a text editor or Excel.
The ./raw_data/
folder contains only untouched downloaded data. Generally this should have been programmatically downloaded by one of the scripts in ./grooming/
but in some cases they might have been downloaded by hand.
The ./grooming/
folder contains scripts that download data (and in some cases save it to the ./raw_data/
folder), tidies, cleans and concords it and saves it in the ./data/
folder.
The ./analysis/
folder contains scripts that perform analysis. These can be R or .Rmd scripts
The `./doc/ folder contains .Rmd and HTML files with documentation.
See also the project issues and project Wiki.
Some of the documents in the Wiki are generated by code in the main repository. For the integrate.R
script to work properly you will need a clone of the Wiki at the location ../international-crime-stats.wiki
.
R chunks in .Rmd files need to be named if they produce images eg they should look like this in the line that starts the chunk, where i2005ch1
is a unique document-chunk combination:
````{r i2005ch1, results = 'asis'}`
This is because all .Rmd files have their .md versions storing their .png images in the same folder, /figure/
. This is something to always look out for in a project that has multiple .Rmd files. Note that the integrate.R
script copies over all files in the /figure/ folder from the main repository over to your local clone of the Wiki's repository.
The ./images/
folder holds images (typically analysis output) that is used in common across the project - for example analytical outputs.
There are a few slightly non-standard R dependencies.
library(webshot)
webshot::install_phantomjs()
See the small arms survey download script.