This function has been conceived with the Dutch FADN in mind, please use `fadn2fd()` for EU FADN data.

`updateFarmData()` creates sample farms by aggregating data based on the weighted mean and the selected mapping for use in FarmDyn. For non-numerical globals, it summarises based on the mode using the `Modes()` function. When `writegdx` is `TRUE`, it writes the GDX in the format 'farmData_(mapping).gdx'.

updateFarmData(
  filename,
  BINDir,
  gdxmap,
  mapping,
  writegdx = TRUE,
  cptcoeffs = FALSE,
  farmchars = NULL,
  cptcoeffsxl = NULL
)

Arguments

filename

Name of the GDX file with BIN data and mappings.

BINDir

Directory where the FADN data is located.

gdxmap

Name of the set in the GDX file that contains the mapping (e.g. Regs2BINID)

mapping

Column name of the characteristic/variable to be grouped by (e.g. "Regions" or "Regs")

writegdx

Logical. If `TRUE`, it writes a GDX with the descriptive statistics.

cptcoeffs

Logical. When this is set to `TRUE` it calculates farm-specific parameters based on CPT coefficients

farmchars

GDX file containing farm characteristics

cptcoeffsxl

Location of the CPT coefficients excel file

Value

A tibble `tbl_df`.

See also

Examples