knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
R must be version 4.0 or higher.
On the command line: navigate to your desired folder location and then enter git clone https://github.com/JGCRI/tradecast.git
If using GitHub Desktop: Go to https://github.com/jgcri/gcamfaostat and click the green "Code" button. Then click "Open with GitHub Desktop".
tradecast
packageOpen the tradecast
folder you just cloned and double-click the gcamfaostat.Rproj
file. RStudio should open the project.
If you have not installed devtools
before, first enter the following into the R console
install.packages("devtools")
Then to load the tradecast
package, enter:
devtools::load_all()
You may also need to install package dependencies, for example using:
devtools::install_deps()
For this reason, we suggest using renv
, described below.
renv
-- currently included in GCAM 6.0 and gcamdata releaseNOTE THAT SETTING UP/RESTORING RENV WHILE ON VPN CAN CAUSE ERRORS HIGHLY RECOMMENDED TO AVOID VPN DURING SET-UP
renv
is an R package for dependency management. Using it will save a private R library with the correct versions of any package dependencies.
The steps to use renv
include:
install.packages( "https://cran.r-project.org/src/contrib/Archive/renv/renv_0.12.5.tar.gz", repos = NULL, type = "source" )
renv::init( bare = TRUE)
renv::restore()
You should now be set to run the driver without running into any package version issues. Note that if you have completed these steps once, your R session should automatically connect to this private library when you open gcamdata.Rproj
. If your R session doesn't connect to this (for example, if you changed branches), you can run the following to reconnect to this private library:
renv::activate()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.