# Define a vector with a namespace
x <- defined("Q42", namespace = c(wd = "https://www.wikidata.org/wiki/"))
# Get the namespace
var_namespace(x)
get_variable_namespaces(x)
# Set the namespace
var_namespace(x) <- "https://example.org/ns/"
# Remove the namespace
var_namespace(x) <- NULL
# Use lower-level helpers (not typically used directly)
namespace_attribute(x)
namespace_attribute(x) <- "https://example.org/custom/"
Run the code above in your browser using DataLab