These functions extract certain attributes from network data:

  • node_attribute() returns an attribute's values for the nodes in a network.

  • node_names() returns the names of the nodes in a network.

  • node_mode() returns the mode of the nodes in a network.

  • tie_attribute() returns an attribute's values for the ties in a network.

  • tie_weights() returns the weights of the ties in a network.

  • tie_signs() returns the signs of the ties in a network.

These functions are also often used as helpers within other functions. node_*() and tie_*() always return vectors the same length as the number of nodes or ties in the network, respectively.

node_attribute(.data, attribute)

node_names(.data)

node_mode(.data)

tie_attribute(.data, attribute)

tie_weights(.data)

tie_signs(.data)

Arguments

.data

An object of a manynet-consistent class:

  • matrix (adjacency or incidence) from {base} R

  • edgelist, a data frame from {base} R or tibble from {tibble}

  • igraph, from the {igraph} package

  • network, from the {network} package

  • tbl_graph, from the {tidygraph} package

attribute

Character string naming an attribute in the object.

Examples

node_attribute(ison_lotr, "Race")
#>  [1] "Human"  "Human"  "Hobbit" "Elf"    "Human"  "Elf"    "Elf"    "Human" 
#>  [9] "Human"  "Hobbit" "Elf"    "Maiar"  "Dwarf"  "Elf"    "Hobbit" "Hobbit"
#> [17] "Hobbit" "Hobbit" "Maiar"  "Human"  "Maiar"  "Elf"    "Ent"    "Human" 
#> [25] "Maiar"  "Human"  "Elf"    "Human"  "Elf"    "Human"  "Elf"    "Elf"   
#> [33] "Hobbit" "Human"  "Maiar"  "Human" 
node_names(ison_southern_women)
#>  [1] "Evelyn"    "Laura"     "Theresa"   "Brenda"    "Charlotte" "Frances"  
#>  [7] "Eleanor"   "Pearl"     "Ruth"      "Verne"     "Myra"      "Katherine"
#> [13] "Sylvia"    "Nora"      "Helen"     "Dorothy"   "Olivia"    "Flora"    
#> [19] "E1"        "E2"        "E3"        "E4"        "E5"        "E6"       
#> [25] "E7"        "E8"        "E9"        "E10"       "E11"       "E12"      
#> [31] "E13"       "E14"      
node_mode(ison_southern_women)
#>   Evelyn Laura Theresa Brenda Charlotte Frances Eleanor Pearl Ruth  Verne Myra 
#> 1 FALSE  FALSE FALSE   FALSE  FALSE     FALSE   FALSE   FALSE FALSE FALSE FALSE
#> # ... with 7 more values from this nodeset unprinted. Use `print(..., n = Inf)` to print all values.
#>   E1    E2    E3    E4    E5    E6    E7    E8    E9    E10   E11   E12   E13  
#> 1 TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE 
#> # ... with 1 more values from this nodeset unprinted. Use `print(..., n = Inf)` to print all values.
tie_attribute(ison_algebra, "task_tie")
#> NULL
tie_weights(to_mode1(ison_southern_women))
#>   [1] 6 6 7 3 4 3 3 3 2 2 2 2 2 1 2 1 1 6 6 3 4 4 3 2 2 2 2 2 1 1 1 6 4 4 4 4 3
#>  [38] 3 3 3 2 2 2 2 1 1 4 4 4 3 2 2 2 2 2 1 1 1 2 2 2 1 1 1 1 3 2 2 1 1 1 1 1 1
#>  [75] 1 3 2 2 2 2 2 1 1 1 2 2 2 2 2 2 1 2 1 1 3 3 2 2 2 2 2 1 1 4 3 3 3 3 3 1 1
#> [112] 4 4 3 4 3 1 1 6 5 4 5 1 1 6 6 4 1 1 6 3 2 2 3 1 1 1 1 2
tie_signs(ison_marvel_relationships)
#>   [1] -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1  1  1  1  1 -1 -1 -1  1 -1 -1 -1 -1 -1 -1
#>  [26] -1 -1 -1 -1 -1 -1 -1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
#>  [51]  1  1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1  1  1  1  1  1  1  1  1  1  1  1  1  1
#>  [76]  1  1  1  1  1  1  1  1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1  1  1  1  1  1  1  1
#> [101]  1  1  1  1  1 -1 -1 -1 -1 -1 -1  1  1  1  1  1  1  1  1 -1 -1 -1 -1  1  1
#> [126]  1  1  1  1  1  1  1  1  1  1  1  1  1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1  1
#> [151]  1  1  1  1  1  1  1  1  1  1 -1 -1 -1 -1 -1 -1  1  1  1  1  1  1  1  1  1
#> [176]  1  1  1  1  1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1  1  1  1  1  1  1  1  1
#> [201]  1 -1 -1 -1 -1 -1 -1  1  1  1  1  1  1  1  1  1 -1 -1 -1 -1 -1 -1 -1 -1  1
#> [226]  1  1  1  1  1  1  1  1  1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
#> [251] -1  1 -1 -1 -1 -1 -1 -1 -1 -1 -1  1  1  1  1  1  1  1  1  1  1  1 -1 -1 -1
#> [276] -1  1  1 -1  1  1  1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1  1  1 -1 -1
#> [301]  1 -1 -1 -1 -1 -1 -1 -1  1  1  1  1  1  1 -1  1  1  1  1  1  1  1  1  1 -1
#> [326] -1 -1 -1 -1 -1 -1 -1  1  1  1  1  1  1  1  1  1 -1 -1 -1 -1 -1 -1 -1 -1 -1
#> [351] -1 -1 -1 -1 -1 -1 -1  1  1  1  1  1  1  1  1  1  1  1  1 -1 -1 -1 -1 -1 -1
#> [376] -1 -1 -1  1  1  1  1  1  1  1  1  1  1  1  1 -1 -1 -1 -1 -1 -1 -1 -1 -1  1
#> [401]  1  1  1  1  1  1  1  1  1 -1 -1 -1 -1 -1 -1 -1  1  1 -1  1  1 -1 -1 -1 -1
#> [426] -1 -1 -1 -1 -1 -1 -1 -1  1  1 -1 -1  1  1  1  1  1  1 -1 -1 -1  1 -1 -1 -1
#> [451] -1 -1 -1  1  1 -1 -1 -1 -1 -1  1  1  1  1  1  1  1 -1 -1 -1 -1 -1 -1 -1 -1
#> [476] -1 -1 -1  1  1  1  1  1 -1 -1 -1 -1 -1  1  1  1  1  1 -1 -1  1  1  1  1  1
#> [501]  1  1 -1  1  1  1  1 -1  1  1  1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1  1  1  1
#> [526] -1 -1 -1 -1  1  1  1  1 -1 -1  1  1  1  1  1 -1 -1 -1  1  1  1 -1 -1 -1 -1
#> [551]  1  1 -1 -1  1 -1  1 -1