Learn R Programming

klassR (version 1.0.2)

klass_node: Given a Klass graph, find the node corresponding to a code and (optionally) a date.

Description

Given a Klass graph, find the node corresponding to a code and (optionally) a date.

Usage

klass_node(graph, x, date = NA)

Value

The node in the graph corresponding to the supplied code. If date is not provided, the node with the most recent code is returned. If date is provided, the code with date between validFrom and validTo is returned.

Arguments

graph

A graph generated by klass_graph.

x

The code to search for.

date

Optional. The specific date the supplied code is valid in.

Examples

Run this code

# Build a graph directed towards the most recent codes.
library(klassR)
if (FALSE) {
klass_131 <- klass_graph(131)
}

# Find the most recent node in the graph representing the code "0101" (Halden,
# valid to 2020.)
if (FALSE) {
halden_node <- klass_node(klass_131, "0101")
}

Run the code above in your browser using DataLab