diff --git a/MTUS-W6-adult-episodes-data-processing.Rmd b/MTUS-W6-adult-episodes-data-processing.Rmd index 33452c78e75155224dd7a332ef4cce6afb0c53c2..90071cbfc7fa48aa0dcc939714f53003af6a8d62 100644 --- a/MTUS-W6-adult-episodes-data-processing.Rmd +++ b/MTUS-W6-adult-episodes-data-processing.Rmd @@ -1,7 +1,7 @@ --- title: "MTUS World 6 Data Processing" -author: "Ben Anderson" -date: "(b.anderson@soton.ac.uk, @dataknut)" +author: "Ben Anderson (b.anderson@soton.ac.uk/@dataknut)" +date: 'Last run at: `r Sys.time()`' output: pdf_document: toc: yes @@ -13,6 +13,7 @@ output: theme: journal toc: yes toc_depth: 3 +bibliography: ~/bibliography.bib --- ```{r setupKnitr, include=FALSE} @@ -24,20 +25,25 @@ knitr::opts_chunk$set(fig_caption = TRUE) knitr::opts_chunk$set(tidy = TRUE) ``` -# About this document +# Introduction -Document last refreshed: `r Sys.time()` +Purpose: -This document was created using [knitr](https://cran.r-project.org/package=knitr) in [RStudio](http://www.rstudio.com). Knitr supports the embedding of R statistical analysis code within markdown text documents allowing them to be updated and re-run. Things to note: +* To process the MTUS World 6 episode data +* To save a processed & gzipped .csv file containing data for just the UK. + +Data: -* Depending on the options set Knitr will display warnings (but not errors) from R. The warnings may or may not be important to the interpretation of the results; -* Knitr is very clever but it does not always support pretty tables. +* MTUS [World 6](http://www.timeuse.org/mtus) - episodes file This work was funded by RCUK through the End User Energy Demand Centres Programme via the "DEMAND: Dynamics of Energy, Mobility and Demand" Centre: * http://www.demand.ac.uk * http://gow.epsrc.ac.uk/NGBOViewGrant.aspx?GrantRef=EP/K011723/1 +Code: + * https://github.com/dataknut/MTUS + `License:` `The R code embedded in this document is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License (http://choosealicense.com/licenses/gpl-2.0/), or (at your option) any later version.` @@ -46,8 +52,16 @@ This work was funded by RCUK through the End User Energy Demand Centres Programm >YMMV - http://en.wiktionary.org/wiki/YMMV -*** +# Set up R environment +Key packages used: + + * base R - for the basics [@baseR] + * foreign - for loading SPSS data [@foreign] + * data.table - for fast (big) data handling [@data.table] + * knitr - to create this document [@knitr] + * dplyr & dtplyr - for data manipulation [@dplyr][@dtplyr] + ````{r houseKeeping} # Clear out all old objects etc ---- # to avoid confusion @@ -57,15 +71,12 @@ rm(list = ls()) starttime <- Sys.time() # Load required packages ---- -packs <- c("ggplot2", # slick & easy graphs - "foreign", # loading SPSS/STATA +packs <- c("foreign", # loading SPSS/STATA "data.table", # fast data manipulation - "gmodels", # for table proportions - "knitr", # for kable - "profvis", # profiling code visualisations - "dplyr" # data transformation + "dplyr", # data manipulation + "dtplyr", # data table & dplyr code + "knitr" # for kable ) -# xtable - not useful: outputs latex only ---- # do this to install them if needed # install.packages(x) @@ -84,16 +95,6 @@ episodesFile <- "MTUS-adult-episode.sav" efile <- paste0(mtusPath, episodesFile) ```` -# Introduction -Purpose: - -* To process the MTUS World 6 episode data (`r episodesFile`) -* To save a processed & gzipped .csv file containing data for just the UK. - -Data: - -* MTUS [World 6](http://www.timeuse.org/mtus) - episodes file - # Load and process episodes file Loading and processing `r efile`. @@ -840,5 +841,4 @@ kable( __Meta:__ Analysis completed in: `r round(Sys.time() - starttime, 3)` seconds using [knitr](https://cran.r-project.org/package=knitr) in [RStudio](http://www.rstudio.com). -*** -__Footnotes:__ +# References diff --git a/MTUS-W6-adult-episodes-data-processing.pdf b/MTUS-W6-adult-episodes-data-processing.pdf index fc7088354d082c5acf03143979fcbd54fcfb590e..24edd33d23946d54a02858ae9c95020eb61d07ff 100644 Binary files a/MTUS-W6-adult-episodes-data-processing.pdf and b/MTUS-W6-adult-episodes-data-processing.pdf differ