Skip to contents

given a set of index ids as retrieved from make_index_ids return an adjacency matrix with pointers to identifiers that flow to the row of the matrix in question.

Usage

make_fromids(index_ids, return_list = FALSE, upmain = NULL)

Arguments

index_ids

data.frame as returned by make_index_ids

return_list

logical if TRUE, the returned list will include a "froms_list" element containing all from ids in a list form.

upmain

data.frame containing id and upmain columns. upmain should be a logical value indicating if the id is the upmain connection from its downstream neighbors.

Value

list containing a "froms" matrix, "lengths" vector, and optionally "froms_list" elements.

Examples


x <- data.frame(id = c(1, 2, 3, 4, 5, 6, 7, 8, 9),
              toid = c(2, 3, 4, 5, 0, 7, 8, 9, 4))

y <- make_index_ids(x)

make_fromids(y)
#> $froms
#>      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
#> [1,]   NA    1    2    3    4   NA    6    7    8
#> [2,]   NA   NA   NA    9   NA   NA   NA   NA   NA
#> 
#> $lengths
#> [1] 0 1 1 2 1 0 1 1 1
#>