klass_node: Given a Klass graph, find the node corresponding to a code...

View source: R/UpdateKlass-graph-navigate.R

klass_nodeR Documentation

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)

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)
## Not run: 
klass_131 <- klass_graph(131)

## End(Not run)

# Find the most recent node in the graph representing the code "0101" (Halden,
# valid to 2020.)
## Not run: 
halden_node <- klass_node(klass_131, "0101")

## End(Not run)

klassR documentation built on April 4, 2025, 4:16 a.m.

Related to klass_node in klassR...