Skip to content
Snippets Groups Projects
Commit cac897a1 authored by Ben Anderson's avatar Ben Anderson
Browse files

amended summary stats to include all data before keeping only UK

parent 8b8e8a9d
No related branches found
No related tags found
No related merge requests found
...@@ -105,20 +105,27 @@ Things that are NOT fixed here: ...@@ -105,20 +105,27 @@ Things that are NOT fixed here:
Loading `r sfile`. Loading `r sfile`.
```{r loadSurveyData} ```{r loadSurveyData}
MTUSW6UKsurvey_DT <- as.data.table(read.spss(sfile))[countrya == "United Kingdom"] # load UK only from SPSS MTUSW6survey_DT <- as.data.table(read.spss(sfile)) # load from SPSS
setkey(MTUSW6UKsurvey_DT, countrya, survey, swave, msamp, hldid, persid, id) setkey(MTUSW6survey_DT, countrya, survey, swave, msamp, hldid, persid, id)
``` ```
We have loaded `r length(MTUSW6UKsurvey_DT$id)` rows of data distributed as follows. We have loaded `r format(nrow(MTUSW6survey_DT), big.mark=",",scientific=FALSE)` rows of data for `r format(uniqueN(MTUSW6survey_DT$countrya), big.mark=",",scientific=FALSE)` countries.
```{r basicStats} ```{r basicStats}
kable(caption = "Number of cases per year", kable(caption = "Number of diaries per year",
table(MTUSW6UKsurvey_DT$survey, MTUSW6UKsurvey_DT$year, useNA = "always") table(droplevels(MTUSW6survey_DT$countrya), # removes unused countries
MTUSW6survey_DT$survey)
) )
``` ```
# Process survey data ```{r keepUKOnly}
MTUSW6UKsurvey_DT <- subset(MTUSW6survey_DT, countrya == "United Kingdom")
```
We now delete the non-UK data leaving us with `r format(nrow(MTUSW6UKsurvey_DT), big.mark=",",scientific=FALSE)` rows of survey data.
# Process UK survey data
```{r processSurveyData} ```{r processSurveyData}
print("-> Create uniq id for diaries (for matching) and persons") print("-> Create uniq id for diaries (for matching) and persons")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment