Learn R Programming

dataset (version 0.3.4)

var_namespace: Get / Set a namespace of measure

Description

Retain the namespace part of a permanent, global variable identifier which is independent of the R instance in use.

Usage

var_namespace(x, ...)

var_namespace(x) <- value

get_variable_namespaces(x, ...)

namespace_attribute(x)

get_namespace_attribute(x)

set_namespace_attribute(x, value)

namespace_attribute(x) <- value

Value

The namespace attribute of a vector constructed with defined.

Arguments

x

a vector

...

Further potential parameters reserved for inherited classes.

value

a character string or NULL to remove the namespace of measure.

Details

The namespace attribute is useful when users join or concatenate data from remote, linked, and open data sources. In such cases, variable identifiers (labels or names) are often resolved with a common namespace prefix, which, together with the namespace, forms a URI or IRI permanent identifier for the variable. Retaining the namespace in such cases allows cross-validation or success later updates of the vector (as a column of a dataset.)

get_variable_namespaces() is identical to var_namespace(). See vignette("defined", package = "dataset") to use comprehensively with variable labels, namespaces, units of measures, and machine-independent permanent variable identifiers.

See Also

Other defined metadata methods and functions: defined(), var_label(), var_unit()

Examples

Run this code
qid = defined(c("Q275912", "Q116196078"), namespace = "https://www.wikidata.org/wiki/")
var_namespace(qid)

# To remove a namespace
var_namespace(qid) <- NULL

Run the code above in your browser using DataLab