addQueryTable | R Documentation |
This function allows you to add a free-standing table to your project data.
Unlike addScenario
, it does not attempt to run the GCAM Model
Interface; therefore, it is suitable for cases where the data has come from
some other source, such as the output of a post-run analysis code.
addQueryTable(
project,
qdata,
queryname,
clobber = FALSE,
transformation = NULL,
saveProj = TRUE,
strict.rundate = FALSE,
...
)
project |
The project data set to add the query to. This can be either a project data structure the name of a project data file. |
qdata |
Query data to add. This can be either a data frame or the name of a file containing the data in csv format. |
queryname |
The name to use for this query when it is stored in the project. |
clobber |
Flag: if |
transformation |
Transformation function to the data after it has been cleaned up but before it has been added to the project. |
saveProj |
A flag to save the project to disk after data has been added.
A user may want to avoid it if they are for instance calling this method several
times and would prefer to save at the end. Users can always save at anytime by
calling |
strict.rundate |
Flag: if |
... |
Additional parameters to be passed to |
The data to be read can be either a data frame or the name of a file
containing the data. In the latter case, the data will be read using
read.csv
. The format of the table should be similar to the format of
tables produced by the Model Interface. Namely:
There should be a "scenario" column with the scenario name in it. The date of the run, if any, will be stripped off.
There should be one or more columns that identify each data point, such as "region" or "sector". Column names will be converted to lower case.
There should be a "Units" column that gives the measurement unit for the data.
You can have multiple scenarios in a single table if you want. In that case the relevant data will be added to each scenario that appears in the "scenario" column. However, because the run date is stripped off, the scenarios must have distinct scenario names. Having multiple copies of the same scenario (i.e., the same scenario name, but different run dates) is not supported, and attempting to load such a table will result in a single query with duplicated rows.
The scenarios found will be added to the project data set supplied. This can be either the data set itself, or the name of a file containing the data set. Either way, the modified data set will be written back to the file it came from. If the attempt to add the query to any scenarios fails, then the function will throw an error and the project data will be unmodified.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.