setIndicatorValues: Set indicator values in IndicatorData object

View source: R/setIndicatorValues.R

setIndicatorValuesR Documentation

Set indicator values in IndicatorData object

Description

This function fills info into an indicatorData object which can later be uploaded to the database. Usually, this object is first retrieved from the database through the function getIndicatorData. This object will list all data that a user is privileged to alter for a particular indicator. Data is accepted either in the form of an estimate together with an lower and upper quartile of uncertainty, or as a distribution object generated by makeDistribution.

Usage

setIndicatorValues(
  indicatorData = NULL,
  areaId = NULL,
  years = NULL,
  est = NA,
  lower = NA,
  upper = NA,
  distribution = NULL,
  datatype = NA,
  unitOfMeasurement = "Enhetsløs"
)

Arguments

indicatorData

Object of class 'indicatorData' created by getIndicatorValues.

areaId

Numeric. Identifier of the indicator value to be altered.

years

Numeric. Which year to set values for.

est

Numeric. Point estimate for the indicator value. Optional.

lower

Numeric. Lower quartile of estimate. Required when supplying point estimate.

upper

Numeric. Upper quartile of estimate. Required when supplying point estimate.

distribution

distribution object generated by makeDistribution See examples therein.

datatype

Type of observation. Remember to update this when the type changes. Allowed values: NA, 1 = Ekspertvurdering, 2 = Overvåkingsdata, 3 = Beregnet fra modeller. Defaults to NA.

unitOfMeasurement

Text of maximum length 100. Defaults to "Enhetsløs".

Value

Object of class 'indicatorData'.

Author(s)

Jens Åström

See Also

makeDistribution, and getIndicatorValues. The vignette Distributions gives detailed descriptions of the use of setIndicatorValues when revising and updating values for an indicator.

Examples

myData <- indicatorData
class(myData)
myData <- setIndicatorValues(myData, areaId = 7040, years = 1950,
                             est = 0.9, lower = 0.7, upper = 1,
                             datatype = 1)

myDist <- makeDistribution(input = "logNormal",distParams = list("mean" = 40, "sd" = 2))
myData <- setIndicatorValues(myData, areaId = 7041, years = 1950,
                             distribution = myDist,
                             datatype = 2)

myCodasamples <- rnorm(n = 1000, mean = 15)
myData <- setIndicatorValues(myData, areaId = 7042, years = 1950,
                             distribution = makeDistribution(myCodasamples),
                             datatype = 3, unitOfMeasurement = "antall/m2")



NINAnor/NIcalc documentation built on Oct. 26, 2023, 9:37 a.m.