This code was written in R version 4, please use this version to avoid difficulties.
You can download the new version of R here.
RStudio also has built-in functionality for choosing between R versions, if necessary, described here.
- Open this data repository as a project in RStudio by clicking
comix_epipose.Rproj
. - If needed, install the packages by copying and pasting the code below or running
source(file.path("r", "install_packages.R"))
. - Add your country's data in the
data
folder in the project directory. - In the
r/00_run_all.R
file., set country name (countries
) and other variables (path_to_data
,truncate_contacts_n
, andmatrix_boots_n
). - Type
source("r/00_run_all.R")
into the R console from the project folder to create reports. - Outputs will be saved to a directory called
outputs
and in a sub-directory of the country's name (for example,outputs/Portugal
)
** Please do not push any data or outputs to the repository **
* If running with the Knit
button in RStudio, clear workspace and set variables in the r/setup_report.R
file. Output will be in the r
folder.
If you would like to make any changes to the report, you can either do so in your local environment for your own use, or you can make a pull request for changes you would like to share with the consortium.
Please follow these guidelines:
- Use tidyverse packages and conventions to keep a common style to the repository.
- Changes must be applicable to all countries or be able to handle differences between countries. The code should be able to run for all countries.
- Summarise new code and functionality when you open the pull request.
- Keep dependencies to a minimum, try to use the ones already in use if possible. If you add a dependency, please add the package to the README and "r/install_packages.R" file.
- Follow this code of conduct for reviewing and receiving feedback: https://github.com/thoughtbot/guides/tree/main/code-review (thanks thoughtbot!)
Copy and paste this code into your R or Rstudio console. You should only need to do this once.
install.packages("countrycode")
install.packages("cowplot")
install.packages("data.table")
install.packages("dplyr")
install.packages("forcats")
install.packages("ggplot2")
install.packages("ggthemr")
install.packages("here")
install.packages("kableExtra")
install.packages("knitr")
install.packages("patchwork")
install.packages("qs")
install.packages("reshape2")
install.packages("socialmixr")
install.packages("tidyr")