Learn R Programming

RObsDat (version 16.03)

addVariable: Add an entry to the variables table

Description

The Variables table lists the full descriptive information about what variables have been measured. This functions allows to add an entry.

Usage

addVariable(Code, Name, Speciation = rep("Unknown", NROW(Code)), Unit, SampleMedium = rep("Unknown", NROW(Code)), ValueType = rep("Unknown", NROW(Code)), IsRegular = rep("True", NROW(Code)), TimeSupport = rep(0, NROW(Code)), TimeUnits = rep("Julian year", NROW(Code)), DataType = rep("Unknown", NROW(Code)), GeneralCategory = rep("Unknown", NROW(Code)), NoDataValue = rep(-999999, NROW(Code)))

Arguments

Code
Text code used by the organization that collects the data to identify the variable.
Name
Full text name of the variable that was measured, observed, modelled. Refers to the controlled vocabulary.
Speciation
Text code used to identify how the data value is expressed (i.e., total phosphorus concentration expressed as P). This should be from the SpeciationCV controlled vocabulary table.
Unit
the units of the data values associated with the variable. Refers to the Units controlled vocabulary.
SampleMedium
The medium in which the sample or observation was taken or made. This should be from the SampleMediumCV controlled vocabulary table.
ValueType
Text value indicating what type of data value is being recorded. This should be from the ValueTypeCV controlled vocabulary table.
IsRegular
Value that indicates whether the data values are from a regularly sampled time series.
TimeSupport
Numerical value that indicates the time support (or temporal footprint) of the data values. 0 is used to indicate data values that are instantaneous. Other values indicate the time over which the data values are implicitly or explicitly averaged or aggregated.
TimeUnits
Integer identifier that references the record in the Units table giving the Units of the time support. If TimeSupport is 0, indicating an instantaneous observation, a unit needs to still be given for completeness, although it is somewhat arbitrary.
DataType
Text value that identifies the data values as one of several types from the DataTypeCV controlled vocabulary table.
GeneralCategory
General category of the data values from the GeneralCategoryCV controlled vocabulary table.
NoDataValue
Numeric value used to encode no data values for this variable.

Value

Nothing is returned

Details

What is missing?

See Also

updateCV to retrieve the vocabularies from the CUAHSI web service and update the database. getMetadata allows to query for meta data.

Examples

Run this code
#connect to standard database
getDefaultDB()
#add data
addVariable(Code="00060", Name="Discharge", Speciation = "Unknown", 
	Unit="m^3/s", SampleMedium = "Not Relevant", 
	ValueType = "Field Observation", TimeSupport = 0, 
	DataType = "Unknown", GeneralCategory = "Hydrology")
getMetadata("Variable", Name="Discharge")

Run the code above in your browser using DataLab