Installing DRpower

Step 1: install a C++ compiler

DRpower is an R package, but it uses C++ code under the hood via the Rcpp package to make calculations faster. When you load the package for the first time, these C++ files must be compiled on your local machine. This requires you to have a C++ compiler installed.

Expand the arrow to see instructions for your operating system:
Windows
  1. Install Rtools, which contains a series of tools for building R packages.
  2. Once you have Rtools installed you should be able to compile.
Mac
  1. Open a Terminal window. You can do this by searching (keyboard shortcut command+space) for “Terminal”.
  2. Inside the terminal window, type the command xcode-select --install. This will prompt you to install Xcode command line tools.
  3. Once you have Xcode command line tools installed you should be able to compile.
Linux (Ubuntu)
  1. Installing on Linux is a bit more tricky. Start by installing gcc.
  2. Open a Terminal window.
  3. Execute the command sudo apt-get install r-base-dev.
  4. You should now be able to compile.


Step 2: install and load the R package

In R, ensure that you have the devtools package installed by running

install.packages("devtools", repos = 'http://cran.us.r-project.org')

You can then install the DRpower package directly from GitHub by running

devtools::install_github("mrc-ide/DRpower", ref = "v1.0.2")

Assuming everything installed correctly, we need to load the package:

library(DRpower)

You can test that the package is loaded and working by running the following command, which should produce this output:

check_DRpower_loaded()
DRpower version 1.0.2 loaded successfully!
Back to top