rgcam-package: Extract GCAM data from GCAM databases and import into R

rgcam-packageR Documentation

Extract GCAM data from GCAM databases and import into R

Description

The rgcam package provides functions for extracting GCAM data from GCAM output databases and importing it into R for analysis. The central concept in rgcam is the "project data file", which contains an R-native representation of selected queries for one or more scenarios. The package provides functions to run the GCAM Model Interface to extract data and add the results to a new or existing project data file, as well as to manage previously created project data.

Usage

You can create or add to a project file using the 'addScenario' function. You will need a GCAM output database and an XML file containing the queries that you want to extract from it. You could then get started by running, for example: conn <- localDBConn('/path/to/dbs', 'gcamdb_basexdb') project.data <- addScenario(conn, 'project.dat', 'scenario-name' 'batch_queries.xml') This command would run the queries in 'batch_queries.xml' against the database 'gcamdb_basexdb', extract the results for a scenario called "scenario-name", and write the results to a file called "project.dat". If you have other scenarios, whether in the same database or a different one, you can make additional calls to 'addScenario' to add them to the project data. The results are also returned and assigned to 'project.data' so that you can begin working with them.

If you already have a project data file that you want to work with, you can load it using 'loadProject': project.data <- loadProject('project.dat')

There are also functions to list scenarios and queries and to pull queries from the data set: ## List scenarios and queries scenarios <- listScenarios(project.data) queries <- listQueries(project.data, 'scenario-name') ## Retrieve a query for all scenarios in the dataset, ## formatted as a single table co2 <- getQuery(project.data, 'query-name')

Author(s)

Maintainer: Robert Link robert.link@pnnl.gov [lyricist, artistic director]

Authors:


JGCRI/rgcam documentation built on July 2, 2022, 10:20 a.m.