Skip to content

Commit

Permalink
Merge pull request #47 from statisticsnorway/dev-fix
Browse files Browse the repository at this point in the history
Added package reference for E and V
  • Loading branch information
sjentoft authored Nov 8, 2024
2 parents c46bbac + 7995356 commit 3c13a33
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion R/UpdateKlass-graph-build.R
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ klass_graph <- function(classification, date = NULL) {
graph <-
igraph::reverse_edges(
graph = graph,
eids = igraph::E(graph)[E(graph)$changeOccurred > date]
eids = igraph::E(graph)[igraph::E(graph)$changeOccurred > date]
)

klass_vertices <-
Expand Down
14 changes: 7 additions & 7 deletions R/UpdateKlass-graph-navigate.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ klass_node <- function(graph, x, date = NA) {
if (!is.na(date)) {
date <- as.Date(date[[1]])

node <- igraph::V(graph)[V(graph)$code == x &
date >= V(graph)$validFrom &
(date < V(graph)$validTo | is.na(V(graph)$validTo))]
node <- igraph::V(graph)[igraph::V(graph)$code == x &
date >= igraph::V(graph)$validFrom &
(date < igraph::V(graph)$validTo | is.na(igraph::V(graph)$validTo))]
} else {
x_indices <- which(V(graph)$code == x)
x_indices <- which(igraph::V(graph)$code == x)

highest_variant_index <-
suppressWarnings(
x_indices[which(V(graph)[x_indices]$variant ==
max(V(graph)[x_indices]$variant))]
x_indices[which(igraph::V(graph)[x_indices]$variant ==
max(igraph::V(graph)[x_indices]$variant))]
)

node <- V(graph)[highest_variant_index]
node <- igraph::V(graph)[highest_variant_index]
}

if (length(node) > 1) {
Expand Down

0 comments on commit 3c13a33

Please sign in to comment.