install.packages("devtools", repos = 'http://cran.us.r-project.org')
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
- Install Rtools, which contains a series of tools for building R packages.
- Once you have Rtools installed you should be able to compile.
Mac
- Open a Terminal window. You can do this by searching (keyboard shortcut command+space) for “Terminal”.
- Inside the terminal window, type the command
xcode-select --install
. This will prompt you to install Xcode command line tools. - Once you have Xcode command line tools installed you should be able to compile.
Linux (Ubuntu)
- Installing on Linux is a bit more tricky. Start by installing gcc.
- Open a Terminal window.
- Execute the command
sudo apt-get install r-base-dev
. - 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
You can then install the DRpower package directly from GitHub by running
::install_github("mrc-ide/DRpower", ref = "v1.0.2") devtools
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!