Step By Step Full Example for gcamreport v7.0*
Source:vignettes/Step_By_Step_Full_Example_v7-0.Rmd
      Step_By_Step_Full_Example_v7-0.RmdATTENTION: this tutorial is compatible
with gcamreport v7.0*, i.e, with
gcamreport v7.0.0 and gcamreport v7.0.1
releases. For other releases, please check in the Tutorials
drop-down menu in the main bar.
newline
In this tutorial, we will 1) generate a dataset from a provided
GCAM7.0 database and launch the associated user interface, 2) generate a
dataset from a provided project and launch the corresponding user
interface, and 3) launch the user interface from a provided standardized
dataset. To know more about the gcamreport package
possibilities, look at these tutorials: dataset
generation tutorial and user
interface tutorial.
newline
Example 1: step-by-step standardized dataset generation from a provided database
- Follow the installation guide either with R or Docker. 
- Download the example GCAM7.0 database, store it inside - gcamreport/examples, and unpack it. Make sure that the database is directly located in- gcamreport/examples/database_basexdb_refand an intermediate folder has not appeared.
- Load the - gcamreportlibrary. If you are using Rstudio or Docker, run
devtools::load_all()and if you are using R, run
- Generate the standardized dataset:
## -- store the database path, name, and scenarios in a variable.
dbpath <- "examples"
dbname <- "database_basexdb_ref"
scen <- "Reference"
## -- choose a project name
prjname <- "example1.dat"
## -- generate the reporting dataset until 2050 for EU-12 and EU-15 for all the 
## -- Agricultural variables, save the output in .RData, .csv and .xlsx format, 
## -- and lunch the user interface
generate_report(db_path = dbpath, db_name = dbname, scenarios = scen, 
                prj_name = prjname, final_year = 2050, 
                desired_regions = c('EU-12', 'EU-15'), 
                desired_variables = c('Agricultural*'), 
                save_output = TRUE, launch_ui = TRUE)In case you experience some trouble, check this troubleshooting section.
- Once the project has been generated and the standardized dataset
created, the user interface will prompt. If you are using Rstudio, it
will automatically open. For a better experience, click the
open in browserbutton. If you are using Docker, either type http://localhost:4000 in the browser or go to Docker Desktop and click the last started port.

Note: Remember that the user interface can only be launched through the full R installation or the Docker installation.
- Check the generated dataset: look in the - examplesfolder and you should see two files named- example1_standardized.csvand- example1_standardized.xlsxcontaining the standardized dataset.
- Note that a file called - database_basexdb_ref_example1.dathas appeared in the- examplesfolder. This is the generated project file from the provided database. If you want to rebuild the standardized dataset or launch the user interface, you can use this file directly and avoid rebuilding the project. If you want to proceed as mentioned, you can follow Example 2.
- Note that a file named - example1_standardized.RDatahas appeared in the- examplesfolder. This is the report file generated from the provided database. If you want to launch the user interface in the future, you can use this file directly and avoid creating or loading the project again. If you want to proceed as mentioned, you can follow Example 3.
newline
Example 2: step-by-step standardized dataset generation from a provided project
- Follow the installation guide either with R or Docker 
- In this example we will use an example rgcam project stored in - examplescalled- example2.dat
- Load the - gcamreportlibrary. If you are using Rstudio or Docker, run
devtools::load_all()and if you are using R, run
- Generate the standardized dataset:
## -- store the project path and name in a variable.
prjname <- "examples/example2.dat"
## -- generate the reporting dataset until 2050 for EU-12 and EU-15 for all the 
## -- Agricultural variables, save the output in .RData, .csv and .xlsx format, 
## -- and lunch the user interface
generate_report(prj_name = prjname, final_year = 2050, 
                desired_regions = c('EU-12', 'EU-15'),
                desired_variables = c('Agricultural*'), 
                save_output = TRUE, launch_ui = TRUE)In case you experience some trouble, check this troubleshooting section.
- Once the project has been generated and the standardized dataset
created, the user interface will prompt. If you are using Rstudio, it
will automatically open. For a better experience, click the
open in browserbutton. If you are using Docker, either type http://localhost:4000 in the browser or go to Docker Desktop and click the last started port.

Note: Remember that the user interface can only be launched through the full R installation or the Docker installation.
- Check the generated dataset: look in the - examplesfolder and you should see two files named- example2_standardized.csvand- example2_standardized.xlsxcontaining the standardized dataset.
- Note that a file called - example2_standardized.RDatahas appeared in the- examplesfolder. This is the report file generated from the provided database. If you want to launch the user interface in the future, you can use this file directly and avoid creating or loading the project again. If you want to proceed as mentioned, you can follow Example 3.
newline
Example 3: step-by-step user interface launching from a provided standardized dataset
Note: Remember that the user interface can only be launched through the full R installation or the Docker installation.
- Follow the installation guide either with the R full installation or the Docker installation. 
- In this example we will use a standardized example dataset stored in - examplescalled- example3.RData.
- Load the - gcamreportlibrary:
devtools::load_all()- Launch the user interface for the standardized dataset:
## -- load gcamreport library.
devtools::load_all() # if using Rstudio or Docker
library(gcamreport) # if using R
## -- store the project path and name in a variable.
datapath <- "examples/example3.RData"
## -- launch the user interface
launch_gcamreport_ui(data_path = datapath)In case you experience some trouble, check this troubleshooting section.
- Once the project has been generated and the standardized dataset
created, the user interface will prompt. If you are using Rstudio, it
will automatically open. For a better experience, click the
open in browserbutton. If you are using Docker, either type http://localhost:4000 in the browser or go to Docker Desktop and click the last started port.

- If you just ran Example 1 or Example 2, you should have a variable called
reportin the environment. You can also use it to launch the user interface:
## -- load gcamreport library.
devtools::load_all() # if using Rstudio or Docker
library(gcamreport) # if using R
## -- store the database path, name, and scenarios in a variable.
dataname <- "report"
## -- launch the user interface
launch_gcamreport_ui(data = dataname)