| transf | R Documentation |
Function to transform data from/to matrix/list formats or edge list representing a network.
transf(x, type = c("toarray", "tolist", "toarray2", "toedgel"), lbs = NULL, lb2lb, valued,
sep, ord, sort, sym, add, adc, rm.isol, na.rm)
x |
An array or a list of pair relations. |
type |
Type of transformation:
|
lbs |
(optional) Labels in the transformation. |
lb2lb |
(optional and logical) Is the transformation “label-to-label”? |
valued |
(optional and logical) Treat |
sep |
(optional) Pair separator used for the pairwise relations. |
ord |
(optional, for |
sort |
(optional and logical) Sort the arrays in the output? |
sym |
(optional and logical, for |
add |
(optional) Added elements in the array's domain. |
adc |
(optional) Added elements in the array's codomain. |
rm.isol |
(optional and logical) Remove isolates in |
na.rm |
(optional and logical) Remove missing data or |
Option "tolist" is for transforming a matrix or an array to a list of pair elements.
In case that the lb2lb is enabled in this type of transformation, then lbs
must be provided, whereas the pair separator is optional.
Notice that the default of lb2lb is TRUE for "toarray", while is FALSE for "tolist".
Option type "toarray" will produce a matrix from a list of pair elements, and in this case is advisable to specify the order of the structure.
Three dimensional structures are supported in the transformations with all options.
Data frames are also accepted for the "tolist" option; however, in case that this information
is given as a list of pair relations the output will be a square matrix.
When the transformation option is "edgel", the output is a data frame with the first two
columns for the sending and receiving ties. For simple networks, these two columns are enough and for
multiplex networks additional columns are for the types of tie, one for each (cf. function edgel).
Notice that for high dimensional arrays, the rel.sys function provides additional information
other than the list of pair relations of the entire structure.
Depending on the input data, the result is either a list of pair relations or a matrix of relations.
edgel, bundles, reduc, rel.sys
# scan the multiplication table data
s <- matrix(data=c(1, 1, 1, 3, 3, 3, 3, 3, 3), nrow=3, ncol=3, byrow=TRUE)
# transform the matrix to a list format
s |> transf(lb2lb = TRUE, lbs = c("n","m","u"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.