Skip to contents

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

Usage

klass_node(graph, x, date = NA)

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.

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.

Examples


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

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