View source: R/assembleNiObject.R
assembleNiObject | R Documentation |
Assembles and structures data into a complete and consistent data set for calculating the Nature Index or thematic indices.
assembleNiObject(
inputData = NULL,
indicators = NULL,
referenceValues = NULL,
indicatorObservations = NULL,
ICunits = NULL,
BSunits = NULL,
ecosystems = NULL,
NIunits = NULL,
predefNIunits = c(allArea = T, parts = F, counties = F),
indexType = "ecosystem",
part = "ecosystem",
total = "total",
partOfTotal = 0
)
inputData |
list with elements named
where the second and third elements are lists, while the others are data.frames.
The last two element, | ||||||||||||||
indicators |
data.frame containing indicator characteristics. | ||||||||||||||
referenceValues |
list containing reference value characteristics. | ||||||||||||||
indicatorObservations |
list containing indicator observations characteristics. | ||||||||||||||
ICunits |
data.frame containing ICunits characteristics. | ||||||||||||||
BSunits |
data.frame containing BSunits characteristics. | ||||||||||||||
ecosystems |
data.frame containing ecosystems characteristics. | ||||||||||||||
NIunits |
data.frame containing characteristics of user defined NIunits. | ||||||||||||||
predefNIunits |
named logical vector defining NIunits to be associated
with the data set. Default settings are
| ||||||||||||||
indexType |
character. Valid | ||||||||||||||
part |
character, one of | ||||||||||||||
total |
character, one of | ||||||||||||||
partOfTotal |
numerical scalar in |
assembleNiObject
assembles and restructures a data set into a list of
class niInput
or a list of such lists. Most of the data are
typically imported from the Nature Index database by use of
importDatasetApi
, except the delineation of NIunits (see below).
niInput
objects have the particular structure and format required for
data input to the function calculateIndex
.
NIunits are geographical areas for which the indices are to be calculated.
NIunits may be defined in two ways, either by choosing from predefined units
(argument predefNIunits
), and/or entered as a data.frame with 'user
defined' units (argument NIunits
). The data.frame should contain
variables named NIunitName
and BSunitId
naming NIunits and
defining them in terms of BSunits.
The data set to be assembled may be entered either as a list assigned to the
argument inputData
containing all data elements (see Arguments
above),
or as several objects, one for each element, assigned to other function arguments.
The structure of the assembled data set depends on what type of index to be
calculated (argument indexType
): the Nature Index for major
ecosystem(s) (indexType = "ecosystem"
, default), a thematic index
(indexType = "thematic"
), or a thematic index calculated for a set of
major ecosystems (indexType = "thematic per ecosystem"
).
Parameters part
, total
, and partOfTotal
may be used
to restrict the data set to BSunits satisfying: part/total > partOfTotal
,
where part
and total
are names of variables in the
BSunits
data.frame containing area data.
assembleNiObject
calls checkInputData
to check if the
data set contains all necessary information for calculating the Nature Index,
and whether the data are consistent.
assembleNiObject
also calls elicitate
to elicitate all
observations in the data set that are not given as custom distributions.
A list of class niInput
with elements
[[1]] | indicators | data.frame with indicator data. |
[[2]] | ICunits | integer BSunit x indicator matrix of ICunits. |
[[3]] | BSunits | data.frame of BSunit data. |
[[4]] | referenceValues | data.frame of reference values. |
[[5]] | indicatorValues | list of data.frames of indicator values. |
[[6]] | NIunits | 0/1 BSunit x NIunit matrix of NIunits. |
Bård Pedersen
checkInputData
, elicitate
,
and calculateIndex
.
The vignette objectsInNIcalc
gives a more detailed description
of niDataImport
and niInput
lists.
## Not run:
carnivoreImport <- importDatasetApi(
username = "...",
password = "...",
indic = c("Jerv","Gaupe","Ulv"),
year = c("1990","2000","2010","2014","2019"))
carnivoreInput <- assembleNiObject(inputData = carnivoreImport,
predefNIunits = c(allArea = T, parts = T, counties = F),
indexType = "thematic")
mountainImport <- importDatasetApi(
username = "...",
password = "...",
eco = "Fjell",
year = c("1990","2000","2010","2014","2019"))
mountainInput <- assembleNiObject(inputData = mountainImport,
predefNIunits = c(allArea = T, parts = T, counties = F),
indexType = "ecosystem",
part = "ecosystem",
total = "terrestrial",
partOfTotal = 0.2))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.