...@@ -21,7 +21,7 @@ fadn2fd( ...@@ -21,7 +21,7 @@ fadn2fd(
\item{save_gdx}{Logical. If TRUE, it saves to gdx files} \item{save_gdx}{Logical. If TRUE, it saves to gdx files}
} }
\value{ \value{
A list of dataframes with the FADN data A list of dataframes with the FADN data agggregated and in p_farmData format
} }
\description{ \description{
`fadn2fd()` imports the FADN data from the csv files `fadn2fd()` imports the FADN data from the csv files
......
...@@ -26,6 +26,8 @@ A tibble `tbl_df`. ...@@ -26,6 +26,8 @@ A tibble `tbl_df`.
The `gdxbinwider()` function takes in a GDX file with BIN data as parameters p_farmData_NL and p_farmData2GUI, and a mapping as a set. The `gdxbinwider()` function takes in a GDX file with BIN data as parameters p_farmData_NL and p_farmData2GUI, and a mapping as a set.
Then the data is widened, and the output is a tibble. Then the data is widened, and the output is a tibble.
This function has been conceived with the Dutch FADN in mind, please use `fadn2fd()` for EU FADN data.
The `gdxbinwider()` function takes in a GDX file with BIN data as parameters p_farmData_NL and p_farmData2GUI, and a mapping as a set. The `gdxbinwider()` function takes in a GDX file with BIN data as parameters p_farmData_NL and p_farmData2GUI, and a mapping as a set.
Then the data is widened, and the output is a tibble. Then the data is widened, and the output is a tibble.
} }
......
...@@ -59,9 +59,6 @@ We would like to thank the R GAMS team for this useful function. ...@@ -59,9 +59,6 @@ We would like to thank the R GAMS team for this useful function.
BINDir <- "inst/extdata/GAMS" BINDir <- "inst/extdata/GAMS"
datafile <- 'FarmDynRexampledata.gdx' datafile <- 'FarmDynRexampledata.gdx'
gdxbinwider(datafile, BINDir, 'map2binid', 'mapping') gdxbinwider(datafile, BINDir, 'map2binid', 'mapping')
BINDir <- "inst/extdata/GAMS"
datafile <- 'FarmDynRexampledata.gdx'
gdxbinwider(datafile, BINDir, 'map2binid', 'mapping')
} }
\seealso{ \seealso{
\itemize{ \itemize{
...@@ -72,9 +69,9 @@ gdxbinwider(datafile, BINDir, 'map2binid', 'mapping') ...@@ -72,9 +69,9 @@ gdxbinwider(datafile, BINDir, 'map2binid', 'mapping')
} }
\itemize{ \itemize{
\item{\code{\link[gdxrrw]{wgdx]}}}{Write R data to GDX} \item{\code{\link[gdxrrw]{wgdx}}}{Write R data to GDX}
\item{\code{\link[gdxrrw]{wgdx.lst]}}}{Write multiple symbols to GDX} \item{\code{\link[gdxrrw]{wgdx.lst}}}{Write multiple symbols to GDX}
\item{\code{\link[gdxrrw]{wgdx.reshape]}}}{Write multiple symbols to GDX} \item{\code{\link[gdxrrw]{wgdx.reshape}}}{Write multiple symbols to GDX}
\item{\code{\link[tidyr]{pivot_longer]}}}{Make dataframes longer} \item{\code{\link[tidyr]{pivot_longer}}}{Make dataframes longer}
} }
} }
...@@ -53,6 +53,8 @@ A tibble `tbl_df`. ...@@ -53,6 +53,8 @@ A tibble `tbl_df`.
is 'regions', this function will give you the weighted mean, median, min, max, number of observations per variable for each is 'regions', this function will give you the weighted mean, median, min, max, number of observations per variable for each
region based on the individual farm data. When `writegdx` is `TRUE`, it writes the GDX in the format 'farmStats_(mapping).gdx' region based on the individual farm data. When `writegdx` is `TRUE`, it writes the GDX in the format 'farmStats_(mapping).gdx'
This function has been conceived with the Dutch FADN in mind, please use `fd_dec()` for EU FADN data.
`groupstats()` returns descriptive statistics per group based on the mapping given. For example, if your mapping `groupstats()` returns descriptive statistics per group based on the mapping given. For example, if your mapping
is 'regions', this function will give you the weighted mean, median, min, max, number of observations per variable for each is 'regions', this function will give you the weighted mean, median, min, max, number of observations per variable for each
region based on the individual farm data. When `writegdx` is `TRUE`, it writes the GDX in the format 'farmStats_(mapping).gdx' region based on the individual farm data. When `writegdx` is `TRUE`, it writes the GDX in the format 'farmStats_(mapping).gdx'
...@@ -85,7 +87,7 @@ groupstats('FarmDynRexampledata.gdx', ...@@ -85,7 +87,7 @@ groupstats('FarmDynRexampledata.gdx',
} }
\itemize{ \itemize{
\item{\code{\link{summary]}}}{summary statistics} \item{\code{\link{summary}}}{summary statistics}
\item{\code{\link[psych]{describe}}}{Descriptive statistics} \item{\code{\link[psych]{describe}}}{Descriptive statistics}
\item{\code{\link[gdxrrw]{wgdx}}}{Write R data to GDX} \item{\code{\link[gdxrrw]{wgdx}}}{Write R data to GDX}
\item{\code{\link[gdxrrw]{wgdx.lst}}}{Write multiple symbols to GDX} \item{\code{\link[gdxrrw]{wgdx.lst}}}{Write multiple symbols to GDX}
......
...@@ -27,16 +27,12 @@ Executes FarmDyn from R ...@@ -27,16 +27,12 @@ Executes FarmDyn from R
\description{ \description{
`runFarmDynfromBatch()` does as it says in the function. `runFarmDynfromBatch()` does as it says in the function.
`runFarmDynfromBatch()` does as it says in the function. `runFarmDynfromBatch()` makes it possible to run FarmDyn from R using the batch file
} }
\examples{ \examples{
TODO write example TODO write example
TODO write example
} }
\seealso{ \seealso{
*Globiom?
*Globiom? *Globiom?
} }
...@@ -68,7 +68,9 @@ str_line_replace(somelines, 'AAAAA', 'changedpoles', which='poles') ...@@ -68,7 +68,9 @@ str_line_replace(somelines, 'AAAAA', 'changedpoles', which='poles')
str_line_replace(somelines, 'AAAAA', 'changedall', which='all') str_line_replace(somelines, 'AAAAA', 'changedall', which='all')
somelines <- c('AAAAA', 'textytext', 'BBBBB', 'AAAAA', 'writingwriting', 'AAAAA', 'etc', 'etc', 'BBBBB') somelines <- c('AAAAA', 'textytext', 'BBBBB', \n
'AAAAA', 'writingwriting', 'AAAAA', \n
'etc', 'etc', 'BBBBB')
str_firstLine_replace(somelines, 'AAAAA', 'changedfirstline') str_firstLine_replace(somelines, 'AAAAA', 'changedfirstline')
......
...@@ -53,6 +53,8 @@ A tibble `tbl_df`. ...@@ -53,6 +53,8 @@ A tibble `tbl_df`.
`updateFarmData()` creates sample farms by aggregating data based on the weighted mean and the selected mapping for use in FarmDyn. `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'. 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'.
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. `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'. 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'.
} }
...@@ -87,7 +89,7 @@ updateFarmData('FarmDynRexampledata.gdx', ...@@ -87,7 +89,7 @@ updateFarmData('FarmDynRexampledata.gdx',
\item{\code{\link[FarmDynR]{gdxreshape}}}{Lengthens data and saves to GDX} \item{\code{\link[FarmDynR]{gdxreshape}}}{Lengthens data and saves to GDX}
\item{\code{\link[gdxrrw]{wgdx}}}{Write R data to GDX} \item{\code{\link[gdxrrw]{wgdx}}}{Write R data to GDX}
\item{\code{\link[gdxrrw]{wgdx.lst}}}{Write multiple symbols to GDX} \item{\code{\link[gdxrrw]{wgdx.lst}}}{Write multiple symbols to GDX}
\item{\code{\link[dplyr]{summarise}}}{Make dataframes longer} \item{\code{\link[dplyr]{summarise}}}{Summarises data and aggregates to group}
\item{\code{\link{weighted.mean]}}}{Calculates weighted mean} \item{\code{\link[stats]{weighted.mean}}}{Calculates weighted mean}
} }
} }
...@@ -12,6 +12,8 @@ writeBatch(FarmDynDir, mapping, farmIds) ...@@ -12,6 +12,8 @@ writeBatch(FarmDynDir, mapping, farmIds)
\item{FarmDynDir}{Directory where FarmDyn is located} \item{FarmDynDir}{Directory where FarmDyn is located}
\item{mapping}{Column name of the characteristic/variable to be grouped by (e.g. "Regions" or "Regs")} \item{mapping}{Column name of the characteristic/variable to be grouped by (e.g. "Regions" or "Regs")}
\item{farmIds}{Individual farm Identifiers. This is usually the aggregation (mapping) of your p_farmData file. Whereas here the mapping is just the name of the aggregation, farmIds is a vector of the names of the different farm samples made. For example, if mapping = NUTS0, then famrIds would be AT, BE, BG... etc.}
} }
\value{ \value{
Writes batch file necessary to run FarmDyn Writes batch file necessary to run FarmDyn
...@@ -28,8 +30,6 @@ settings remain the same as you have set them. ...@@ -28,8 +30,6 @@ settings remain the same as you have set them.
\examples{ \examples{
TODO write example TODO write example
TODO write example
} }
\seealso{ \seealso{
\code{\link[FarmDynR]{runFarmDynfromBatch}} \code{\link[FarmDynR]{runFarmDynfromBatch}}
......