Newer
Older
<!-- README.md is generated from README.Rmd. Please edit that file -->
# FarmDynR
Developed by Hugo Scherer and Marc Müller at Wageningen Economic
Research.
<!-- badges: start -->
<!-- badges: end -->
The goal of FarmDynR is to give the user the ability to aggregate FADN
Hugo Scherer
committed
data to create representative farms for any grouping available, generate
descriptive statistics, and to run FarmDyn from R.
## Requirements
This package requires that you have GAMS and FarmDyn installed.
Additionally, the package imports from: - gdxrrw (remember to load GAMS
Hugo Scherer
committed
with `igdx()` with the path to your version of GAMS) - readr - dplyr -
tidyr - readxl
It also suggests: - stringr
## Installation
You can install the development version of FarmDynR like so:
``` r
install.packages('https://gitlab.iiasa.ac.at/mind-step/FarmDynR')
```
## Workflow
Hugo Scherer
committed
The workflow for this package is as follows: 1. Read the FADN data into
R 2. Run `fadn2fd()` with the FADN data, farmbranch desired, the mapping
and the option to save GDX files based on the mapping - Yields will be
calculated and the FADN data will be prepared - Outliers are removed 3.
Write batch file with `writeBatch()` and run FarmDyn with
`runFarmDynfromBatch()` using the created batch file - Optional: Create
descriptive statistics for reporting with `fd_desc()` with the
farmbranch
## Example
``` r
library(FarmDynR)
Hugo Scherer
committed
# Read in FADN data
fadn <- read_fadn("path/to/fadn/data")
# Create mapping
mapping <- list(c("NUTS0", "misc%OrganicCode"), "NUTS0", "NUTS2")
# Create FarmDyn data
fd_data <- fadn2fd(fadn, "Dairy", mapping, save_gdx = FALSE)
# Write batch file
writeBatch(fd_data, "path/to/batch/file")
# Run FarmDyn
runFarmDynfromBatch("path/to/batch/file")
# Create descriptive statistics
fd_desc(fd_data)