View source: R/attribute-element.R
create_attribute | R Documentation |
Create an attribute element according to EML standards.
create_attribute(
attribute_name,
attribute_definition,
measurement_scale,
attribute_label = NULL,
domain = NULL,
definition = NULL,
text_pattern = NULL,
type = NULL,
units = NULL,
number_type = NULL,
unit_precision = NULL,
date_time_format = NULL,
date_time_precision = NULL,
minimum = NULL,
maximum = NULL
)
attribute_name |
The name of a field in a data table. This is often a short and/or cryptic name. It is recommended that the attribute names be suitable for use as a variable, e.g., composed of ASCII characters, and that the attribute names match the column headers of a CSV or other text table. |
attribute_definition |
A precise and complete definition of the attribute being documented. |
measurement_scale |
The type of scale from which values are drawn for the
attribute. A list of approved measurement scales can be viewed at |
attribute_label |
(Optional) Used to provide a less ambiguous or less cryptic
alternative identification than what is provided in |
domain |
Input for the non-numeric measurement scales only. Please list either "text" or "enumerated". |
definition |
Either the text definition or code definition. Both are appended using this parameter, but have different applications. Examples of both are listed below. |
text_pattern |
(Optional) A regular expression pattern constraining the attribute. |
type |
Either "ratio" or "interval". |
units |
The units assigned to this attribute's values. |
number_type |
A list of possible options can be viewed at |
unit_precision |
(Optional) How precise units are measured. |
date_time_format |
The format your date/time attribute is recorded in. ISO 8601 standard should be used (YYYY-MM-DD). |
date_time_precision |
To what level time is being measured. |
minimum |
Theoretical or allowable minimum value. Values can be larger than or equal to this number. |
maximum |
Theoretical or allowable maximum value. Values can be less than or equal to this number. |
An attribute list
Different measurement scale values will indicate different inputs:
Please provide a domain to indicate if your attribute is text or enumerated.
Nominal:
Used to define categorical scale attributes. If your attribute falls
under the domain of "text", please provide the inputs of definition
and text_pattern
.
If your attribute falls under the domain of "enumerated", please provide the input of definition
.
Ordinal:
Used to define ordered scale attributes. If your attribute falls under the domain
of "text", please provide the inputs of definition
and text_pattern
. If your
attribute falls under the domain of "enumerated", please provide the input of definition
.
Interval:
Used to define interval scale attributes. Please provide the inputs of type
,
units
, unit_precision
, number_type
, minimum
, and maximum
.
Ratio:
Used to define ratio scale attributes. Please provide the inputs of type
,
units
, unit_precision
, number_type
, minimum
, and maximum
.
dateTime:
Used to define date and time attributes. Please provide the inputs of date_time_format
,
date_time_precision
, minimum
, and maximum
.
# Nominal(text):
## Not run: create_attribute(attribute_name = "site_id",
attribute_definition = "Site id as used in sites table",
measurement_scale = EMLaide::measurement_scale$nominal,
domain= "text",
definition = "Site id as used in sites table.")
## End(Not run)
# Nominal(enumerated):
code_def_1 = list(code = "yes", definition = "has been captured previously")
code_def_2 = list(code = "no", definition = "has not been captured previously")
code_definition = list(code_def_1, code_def_2)
## Not run: create_attribute(attribute_name = "Recap",
attribute_definition = "Has the Turtle been captured and tagged previously",
measurement_scale = EMLaide::measurement_scale$nominal,
domain = "enumerated",
definition = code_definition)
## End(Not run)
# Ordinal(text):
## Not run: create_attribute(attribute_name = "LatitudeDD",
attribute_definition = "Latitude",
measurement_scale = EMLaide::measurement_scale$ordinal,
domain= "text",
definition = "Latitude")
## End(Not run)
# Ordinal(enumerated):
code_def_0 = list(code = "0", definition = "0 insects per meter of branch")
code_def_1 = list(code = "1", definition = "1-10 insects per meter")
code_def_2 = list(code = "2", definition = "11 – 100 insects per meter")
code_def_3 = list(code = "3", definition = "more than 100 insects per meter")
code_definition = list(code_def_0, code_def_1, code_def_2, code_def_3)
## Not run: create_attribute(attribute_name = "hwa",
attribute_definition = "Hemlock woolly adelgid density per meter of branch",
measurement_scale = EMLaide::measurement_scale$ordinal,
domain = "enumerated",
definition = code_definition)
## End(Not run)
# Interval:
## Not run: create_attribute(attribute_name = "Count",
attribute_definition = "Number of individuals observed",
measurement_scale = EMLaide::measurement_scale$interval,
type = "interval",
units = "number",
unit_precision = "1",
number_type = EMLaide::number_type$whole,
minimum = "0")
## End(Not run)
# Ratio:
## Not run: create_attribute(attribute_name = "pH",
attribute_definition = "pH of soil solution",
measurement_scale = EMLaide::measurement_scale$ratio,
type = "ratio",
units = "dimensionless",
unit_precision = "0.01",
number_type = EMLaide::number_type$real)
## End(Not run)
# dateTime:
## Not run: create_attribute(attribute_name = "Yrs",
attribute_definition = "Calendar year of the observation from years 1990 - 2010.",
measurement_scale = EMLaide::measurement_scale$dateTime,
attribute_label = "Years",
date_time_format = "YYYY",
date_time_precision = "1",
minimum = "1993",
maximum = "2003")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.