GitLab at IIASA

"","all_binid","grouping"
"1","28","E"
"2","80","E"
"3","150","E"
"4","101","E"
"5","111","E"
"6","137","E"
"7","133","E"
"8","166","E"
"9","144","E"
"10","132","E"
"11","98","F"
"12","103","F"
"13","90","F"
"14","70","F"
"15","79","F"
"16","116","F"
"17","14","F"
"18","126","F"
"19","62","F"
"20","4","F"
"21","178","G"
"22","149","G"
"23","40","G"
"24","93","G"
"25","122","G"
"26","181","G"
"27","66","G"
"28","123","G"
"29","48","G"
"30","108","G"
"31","131","G"
"32","87","G"
"33","41","G"
"34","115","G"
"35","72","G"
"36","42","G"
"37","43","G"
"38","2","G"
"39","117","G"
"40","173","G"
"41","49","G"
"42","102","G"
"43","51","G"
"44","134","G"
"45","147","G"
"46","143","G"
"47","57","G"
"48","136","G"
"49","26","G"
"50","160","G"
"51","8","G"
"52","96","G"
"53","22","G"
"54","35","G"
"55","155","G"
"56","157","G"
"57","86","G"
"58","141","G"
"59","10","G"
"60","55","G"
"61","135","H"
"62","120","H"
"63","109","H"
"64","25","H"
"65","3","H"
"66","83","H"
"67","50","H"
"68","180","H"
"69","175","H"
"70","156","H"
"71","174","H"
"72","20","H"
"73","162","H"
"74","63","H"
"75","71","H"
"76","61","H"
"77","140","H"
"78","145","H"
"79","170","H"
"80","184","H"
"81","27","H"
"82","76","H"
"83","153","H"
"84","159","H"
"85","60","H"
"86","65","H"
"87","36","H"
"88","187","H"
"89","19","H"
"90","9","H"
"91","30","H"
"92","114","H"
"93","17","H"
"94","167","H"
"95","58","H"
"96","6","H"
"97","85","H"
"98","91","H"
"99","32","H"
"100","77","H"
"101","95","H"
"102","161","H"
"103","92","H"
"104","164","H"
"105","185","H"
"106","53","H"
"107","186","H"
"108","11","H"
"109","176","H"
"110","179","H"
"111","21","H"
"112","152","H"
"113","119","H"
"114","177","H"
"115","151","H"
"116","99","H"
"117","127","H"
"118","46","H"
"119","165","H"
"120","29","H"
"121","130","I"
"122","16","I"
"123","38","I"
"124","24","I"
"125","97","I"
"126","73","I"
"127","75","I"
"128","183","I"
"129","105","I"
"130","128","I"
"131","15","I"
"132","82","I"
"133","113","I"
"134","171","I"
"135","23","I"
"136","59","I"
"137","52","I"
"138","7","I"
"139","74","I"
"140","104","I"
"141","69","I"
"142","78","I"
"143","139","I"
"144","94","I"
"145","84","I"
"146","56","I"
"147","100","I"
"148","34","I"
"149","37","I"
"150","88","I"
"151","125","I"
"152","138","I"
"153","182","I"
"154","110","I"
"155","168","I"
"156","64","I"
"157","172","I"
"158","47","I"
"159","45","I"
"160","121","I"
"161","118","I"
"162","124","I"
"163","158","I"
"164","163","I"
"165","5","I"
"166","67","I"
"167","169","I"
"168","129","I"
"169","107","I"
"170","68","I"
"171","44","I"
"172","142","I"
"173","33","I"
"174","12","I"
"175","106","I"
"176","1","I"
"177","18","I"
"178","112","I"
"179","13","I"
"180","31","I"
"181","89","I"
"182","39","I"
"183","81","I"
"184","154","I"
"185","148","I"
"186","54","I"
"187","146","I"
"188","dummy","I"
$call csv2gdx map2id.csv id='map2binid' index=2,3 useHeader=Y colCount=3
Set
mapping 'set of fake mapping'
all_binid 'fake id numbers'
map2binid 'map2id';
$gdxIn map2id.gdx
$load all_binid = Dim1
$load mapping = Dim2
$load map2binid
$gdxIn
execute_unload "map2id.gdx"
all_binid
mapping
map2binid
\ No newline at end of file
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data.R
\docType{data}
\name{fd2gui}
\alias{fd2gui}
\title{FarmDynR example data}
\format{
Objects of class `tbl_df`
}
\usage{
data(fd2gui); data(fdnl); data(gdxmapping)
}
\description{
Random fake data used to play with the FarmDynR package.
}
\examples{
data(fd2gui)
data(fdnl)
data(gdxmapping)
}
\keyword{FarmDynR}
\keyword{datasets,}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/FarmDynR.R
\name{gdxload}
\alias{gdxload}
\title{Load from GDX}
\usage{
gdxload(
filename,
symbol = c("set", "param", "scalar"),
symName,
names = NULL,
...
)
}
\arguments{
\item{filename}{Name of the GDX file and its location}
\item{symbol}{The symbol type to be loaded (set, parameter, scalar)}
\item{symName}{The name of the symbol to be loaded}
\item{names}{Column names of the symbol}
\item{...}{Arguments to be passed to gdxrrw::rgdx(...)}
}
\value{
A dataframe
}
\description{
`gdxload()` is a wrapper for gdxrrw::rgdx. It fixes the issue of having all UELs as factor levels for variables for which they do not belong.
}
\seealso{
*gdxrrw::rgdx.set()
*gdxrrw::rgdx.param()
*gdxrrw::rgdx.scalar()
}
......@@ -2,7 +2,7 @@
% Please edit documentation in R/FarmDynR.R
\name{groupstats}
\alias{groupstats}
\title{Reshape from wide to long and save to GDX}
\title{Generate descriptive statistics and save to GDX}
\usage{
groupstats(
filename,
......
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/FarmDynR.R
\name{samplr}
\alias{samplr}
\name{updateFarmData}
\alias{updateFarmData}
\title{Reshape from wide to long and save to GDX}
\usage{
samplr(filename, BINDir, gdxmap, mapping, writegdx = TRUE)
updateFarmData(
filename,
BINDir,
gdxmap,
mapping,
writegdx = TRUE,
cptcoeffs = FALSE,
farmchars = NULL,
cptcoeffsxl = NULL
)
}
\arguments{
\item{filename}{Name of the GDX file with BIN data and mappings.}
......@@ -16,18 +25,24 @@ samplr(filename, BINDir, gdxmap, mapping, writegdx = TRUE)
\item{mapping}{Column name of the characteristic/variable to be grouped by (e.g. "Regions" or "Regs")}
\item{writegdx}{Logical. If `TRUE`, it writes a GDX with the descriptive statistics.}
\item{cptcoeffs}{Logical. When this is set to `TRUE` it calculates farm-specific parameters based on CPT coefficients}
\item{farmchars}{GDX file containing farm characteristics}
\item{cptcoeffsxl}{Location of the CPT coefficients excel file}
}
\value{
A tibble `tbl_df`.
}
\description{
`samplr()` 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'.
}
\examples{
BINDir <- "inst/extdata/GAMS"
datafile <- 'FarmDynRexampledata.gdx'
samplr('FarmDynRexampledata.gdx',
updateFarmData('FarmDynRexampledata.gdx',
&BINDir="inst/extdata/GAMS/",
&gdxmap = 'map2binid',
&mapping = 'mapping',
......