Developed by Hugo Scherer and Marc Müller at Wageningen Economic Research.
The goal of FarmDynR is to give the user the ability to aggregate FADN data to create representative farms for any grouping available, generate descriptive statistics, and to run FarmDyn from R.
This package requires that you have GAMS and FarmDyn installed. Additionally, the package imports from: - gdxrrw (remember to load GAMS with igdx() with the path to your version of GAMS) - readr - dplyr - tidyr - readxl
It also suggests: - stringr
You can install the development version of FarmDynR like so:
install.packages('https://gitlab.iiasa.ac.at/mind-step/FarmDynR')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
library(FarmDynR)
# 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)