rr_links: Links between registers

Description Usage Arguments Examples

View source: R/rr_links.R

Description

Registers can link to each other either by a field with the "register" property, or via CURIEs. See rr_key_links() and rr_curie_links() for more about that. rr_links() returns a data frame of edges.

Usage

1

Arguments

x

Object of class "register", or a list of objects of class "register". If a list of registers, the graph of all links between all registers will be returned.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
sg <- rr_register("statistical-geography")
rr_links(sg)

allergen <- rr_register("allergen")
rr_links(allergen)

registers <- rr_registers()
rr_links(registers)

if (require(tidygraph) && require(ggraph)) {
  rr_register("statistical-geography") %>%
  rr_links() %>%
  as_tbl_graph() %>%
    ggraph(layout = "nicely") +
      geom_edge_fan(aes(alpha = ..index..), show.legend = FALSE) +
      geom_edge_loop() +
      geom_node_label(aes(label = name)) +
      theme_void()

  edge_arrow <- arrow(length = unit(4, "mm"), type = "closed")
  registers %>%
    rr_links() %>%
    dplyr::distinct(from, to, type) %>%
    as_tbl_graph() %>%
    ggraph(layout = "nicely") +
      geom_node_point() +
      geom_edge_fan(aes(colour = type),
                    arrow = edge_arrow,
                    end_cap = circle(2, 'mm')) +
      geom_edge_loop(aes(colour = type),
                     arrow = edge_arrow,
                     end_cap = circle(2, 'mm')) +
      geom_node_label(aes(label = name), repel = TRUE, alpha = .5) +
      theme_void()
}

nacnudus/registr documentation built on May 5, 2019, 12:31 p.m.