diff --git a/MTUS-W6-adult-episodes-data-processing.Rmd b/MTUS-W6-adult-episodes-data-processing.Rmd index 90071cbfc7fa48aa0dcc939714f53003af6a8d62..0da1f89dae6d8976ac82327491c0dc14cad5f4a7 100644 --- a/MTUS-W6-adult-episodes-data-processing.Rmd +++ b/MTUS-W6-adult-episodes-data-processing.Rmd @@ -3,16 +3,16 @@ title: "MTUS World 6 Data Processing" author: "Ben Anderson (b.anderson@soton.ac.uk/@dataknut)" date: 'Last run at: `r Sys.time()`' output: - pdf_document: - toc: yes - toc_depth: 3 - number_sections: yes html_document: fig_caption: yes number_sections: yes theme: journal toc: yes toc_depth: 3 + pdf_document: + number_sections: yes + toc: yes + toc_depth: 3 bibliography: ~/bibliography.bib --- @@ -100,21 +100,22 @@ Loading and processing `r efile`. ```{r loadEpisodesFile} system.time( - mtusEpsDT <- as.data.table(read.spss(efile)) + mtusEpsW6DT <- as.data.table(read.spss(efile)) ) ``` -We have loaded `r format(nrow(mtusEpsDT), big.mark=",",scientific=FALSE)` rows of data for `r format(uniqueN(mtusEpsDT$countrya), big.mark=",",scientific=FALSE)` countries. +We have loaded `r format(nrow(mtusEpsW6DT), big.mark=",",scientific=FALSE)` rows of data for `r format(uniqueN(mtusEpsW6DT$countrya), big.mark=",",scientific=FALSE)` countries. ```{r basicStats} kable(caption = "Number of diaries per year", - table(droplevels(mtusEpsDT$countrya), # removes unused countries - mtusEpsDT$survey) + ba_tidyNum(table(mtusEpsW6DT$survey, droplevels(mtusEpsW6DT$countrya) # removes unused countries + ) ) +) ``` ```{r keepUKOnly} -mtusUKEpsDT <- subset(mtusEpsDT, countrya == "United Kingdom") +mtusUKEpsDT <- subset(mtusEpsW6DT, countrya == "United Kingdom") ``` We now delete the non-UK data leaving us with `r format(nrow(mtusUKEpsDT), big.mark=",",scientific=FALSE)` rows of survey data.