This repository contains the R project set up with the packrat package for code used for the analysis in the paper 'Deforestation spillovers from oil palm sustainability certification' (https://doi.org/10.1088/1748-9326/ab7f0c). This project has a private project library that installs version of libraries and any dependencies used in the code for this project. In addition, the repo contains all data necessary to replicate the paper's analyses.
-
Download or clone repository to local machine. If the location of the project folder is in a location that is being backed up by a cloud storage service like
DropboxorMicrosoft OneDrive, pause the syncing process to prevent any issues with the package installation process. -
Extract files in
data.zip(long_kali.csv,master_mill_data.csvandlong_kali_metadata.csv) in theinputfolder into the same folder. -
Open
Rproject filerspo_leakage.Rprojin RStudio. Once the project opens,packratwill automatically install into the project private library. TheRsession will restart when this is completed. -
Run
packrat::status()in the console to see list of packages used in the code that need to be installed for you to run the code. -
Run
packrat::restore()in the console to install all required packages and dependencies. If required, a window will pop up requestingRToolsto be installed. Install RTools and then re-runpackrat::restore()to finishing installing any other packages and dependencies. -
Once all packages have been installed, open
leakage.Rand run the code. Figures, plot and tables will be saved into theoutputfolder.
[1] https://rstudio.github.io/packrat/
[2] http://rstudio-pubs-static.s3.amazonaws.com/221948_fb7215fecb0d49ac903f701fd8d45132.html
[3] https://blog.methodsconsultants.com/posts/using-packrat-with-git-submodules/