Dynamic model of SARS-CoV-2 transmission, implemented in C++ and R.
This code is under active development. Currently, the developers cannot provide technical support.
In order to use covidm
, you will need to be able to build packages from source. Instructions for how to set this up for Mac OS X and Windows are below. Be sure to read the instructions if you want covidm
to be able to use multithreading on Mac OS X.
To install covidm
from github, you will need the remotes
package:
install.packages("remotes")
You can then install covidm
from github:
remotes::install_github("nicholasdavies/covidm-alpha")
To build packages from source on Mac OS X, you need to have the Command Line Tools installed. To check if you do, type clang -v
in the Terminal; if it gives you information on the version number then you have Command Line Tools installed. If you get an error like zsh: command not found: clang
, then install Command Line Tools by typing xcode-select --install
and following the prompts.
(Optional) If you want covidm
to be able to use multithreading (i.e. speed up simulations by distributing them across multiple processor cores), you will need to install OpenMP support. The latest instructions for how to do this on Mac OS X are available at https://mac.r-project.org/openmp, but here's the gist of it:
-
Type
clang -v
in the Terminal to see which version of clang you have installed. You are looking for something likeApple clang version 11.0.3 (clang-YYYY.12.34.56)
— it's the 4-digit YYYY number you need. -
Go to https://mac.r-project.org/openmp and look in the table under OpenMP run-time downloads for the right file. Under the Build header, you'll see that each file corresponds to an LLVM version, an XCode version, and an Apple clang version; you want the Release file that corresponds to the Apple clang version YYYY from step 1.
-
Run
curl -O https://mac.r-project.org/openmp/openmp-9.0.1-darwin17-Release.tar.gz
in the Terminal, substituting the file name you need, to download OpenMP. -
Then run
sudo tar fvx openmp-9.0.1-darwin17-Release.tar.gz -C /
in the Terminal, again substituting the name of the file from step 2, to install OpenMP. You will be asked for your password.
To build packages from source on Windows, read on.
Install Rtools
by following the instructions at https://cran.r-project.org/bin/windows/Rtools/.
-
Install the correct version of
Rtools
for your version of R (https://cran.r-project.org/bin/windows/Rtools/history.html). For example, for version 3.6.3 you want Rtools35.exe. The next step assumes that you install toC:\Rtools
, the recommended directory. -
So that R can find
Rtools
, run this command from R:
writeLines('PATH="C:\\Rtools\\bin;${PATH}"', con = "~/.Renviron")
This creates a file called .Renviron
in your Documents folder and writes the line PATH="C:\\Rtools\\bin;${PATH}"
to it. You can also do this manually if you prefer.