Description Usage Arguments Details Value Warning Examples
Create an adjacency matrix from two ordinal variables.
1  adj_matrix(x, y, states = NULL, direction = NULL)

x 

y 

states 
Optional integer. Specify the max number of states
between the two vectors. The outputed matrix will be of
size 
direction 
Optional string. Specify "up" to create an adjacency matrix from only increasing transitions, or "down" for decreasing transitions. 
The adjacency matrix represents paired transitions for two
variables. If we consider each possible unique pair as
serialized on an ordinal scale (1, 2, .., K
) then the
column numbers of the adjacency matrix denote the start
position of the transition (the observed pair at
observation i
) and the row numbers denote the end
position of the transition (the observed pair at
observation i + 1
). This can be visualized graphically
with plot
or as an igraph
adjacency graph with
igraph::graph.adjacency.
A S3
matrix of class adj_mat
. Can be plotted with the
normal plot
function.
adj_matrix
assumes that the target
variables are indexed at 0.
1 2 3  x < c(1, 2, 2)
y < c(2, 1, 2)
adj_matrix(x, y) # `states` will be set to 3

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.