Skip to content

Commit

Permalink
update site & improve document
Browse files Browse the repository at this point in the history
  • Loading branch information
realxinzhao committed Aug 19, 2023
1 parent 3e25cdf commit ac9e0e5
Show file tree
Hide file tree
Showing 122 changed files with 3,212 additions and 614 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: gcamfaostat
Type: Package
Title: Prepare, process, and synthesize FAOSTAT data for global agroeconomic and multisector dynamic modeling
Version: 1.1
Version: 1.0.0
Date: 2023-05-06
Authors@R: c(person("Xin", "Zhao", email = "[email protected]", role = c("cre", "aut"), comment = c(ORCID = "0000-0002-1801-4393")),
person("Maksym", "Chepeliev", role = "aut"),
Expand Down
50 changes: 45 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,58 @@
[![codecov](https://codecov.io/gh/JGCRI/gcamdata/branch/main/graph/badge.svg)](https://codecov.io/gh/JGCRI/gcamdata)
![R-CMD](https://github.com/JGCRI/gcamdata/workflows/R-CMD/badge.svg)
![coverage-test](https://github.com/JGCRI/gcamdata/workflows/coverage-test/badge.svg)


# gcamfaostat
**gcamfaostat** is an R package to prepare, process, and synthesize FAOSTAT data for global agroeconomic and multisector dynamic modeling. The Food and Agriculture Organization Statistical Database ([FAOSTAT](https://www.fao.org/faostat/en/#data)) provdes open access data on country-level agricultural production, trade, food, nutrients, prices, land use, etc, servering as the most important data source for global agroeconomic and multisector dynamic models. **gcamfaostat** aims to shorten the distance between the FAOSTAT raw data to economic modeling.

# gcamfaostat and gcamdata
**gcamfaostat** is built based on an existing R package, **[gcamdata](https://jgcri.github.io/gcamdata/index.html)**, which has similar functions to**gcamfaostat** though **gcamdata** includes broader aspects of data inputs and is designed for the global multisector dynamic model **GCAM**. **gcamfaostat** utilizes the robust, reproducible and transparent data processing systems built in **[gcamdata](https://github.com/JGCRI/gcam-core)**. The two packages are consistent, while **gcamfaostat** focuses on agroeconomic data processing and can provide input data for **gcamdata** (and thus GCAM) and other models that rely on FAOSTAT data.


# gcamdata-faostat
Functions in this R package (**gcamdata-faostat**) download, clean, processe, connect, and visualize data from FAOSTAT for global economic and integrated assessment modeling. The package is built based on the existing gcamdata package structure for consistency, transparency, and traceability.

The goals of this version are:
(1) Check FAOSTAT data updates and download necessary datasets
(2) Develop a new method of primary equivalent aggregation to aggregate supply-utilization-accounting (SUA) data for items along the supply chain (e.g., wheat flour, bran, and germ to wheat-primary-equivalent). The method preserves balance across space (trade balance), time (storage carryover), supply-utilization, and the combination of these dimensions with minimal adjustments.
(3) Apply the new method of primary equivalent aggregation to aggregating FAO ~500 SUA (SCL) items to ~100 primary equivalent items in FAO Food Balance Sheet (FBS).
(4) Compare the balanced data compiled using different methods and visualize the difference.

# User Guide
The package is documented in the [online manual](https://realxinzhao.github.io/gcamfaostat/index.html)


# Download and install:

```r
install.packages("devtools")
devtools::install_github("realxinzhao/gcamfaostat")
```
# Loading and run the gcamdata package

Open the `gcamfaostat.Rproj` file in the `gcamfaostat` folder. RStudio should open the project.

To load the `gcamdata` package, enter:

```{r eval = FALSE}
devtools::load_all()
```

## Run the driver
There are two ways to run the driver:
1.
```{r eval = FALSE}
driver_drake()
```
`driver_drake()` runs the driver and stores the outputs in a hidden cache. When you run `driver_drake()` again it will skip steps that are up-to-date. This is useful if you will be adjusting the data inputs and code and running the data system multiple times. For this reason, we almost always recommend using `driver_drake()`. More details can be found in the [vignette](https://jgcri.github.io/gcamdata/articles/driverdrake_vignette.html).

2.
```{r eval = FALSE}
driver()
```
See [the documentation](https://jgcri.github.io/gcamdata/reference/driver.html) for more options when running the driver, such as what outputs to generate or when to stop.

## Output files

Users can specify the output directory (`DIR_OUTPUT_CSV`) that stores the output csv files in `constants.R`. The default directory is `outputs/CSV`. The the file will be exported when `OUTPUT_Export_CSV == TRUE` (an option in `constants.R`).
Users can also make use of the functions to trace the processing by step, when`driver_drake()` is employed.




Expand Down
13 changes: 11 additions & 2 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,21 @@ navbar:
left:
- icon: fa-home
href: index.html
- text: "Getting Started"
href: articles/getting-started/getting-started.html
- text: "Vignettes"
icon: fas fa-book
menu:
- text: "getting started"
href: articles/getting-started.html
- text: "User Modification Functions"
href: articles/usermod_vignette.html
- icon: fa-file-code-o
text: "Reference"
href: reference/index.html
- icon: fa-newspaper-o
text: "News"
href: articles/news.html



reference:
- title: Running gcamfaostat
Expand Down
26 changes: 23 additions & 3 deletions docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 23 additions & 5 deletions docs/LICENSE-text.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 27 additions & 7 deletions docs/articles/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ac9e0e5

Please sign in to comment.