transf: Transform Data from/to Matrix/List Formats

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/transf.R

Description

Function to transform data from/to matrix/list formats representing a network.

Usage

1
2
transf(x, type = c("tolist", "toarray"), lbs = NULL, lb2lb, 
    sep, ord)

Arguments

x

an array or a list of pair relations

type

whether the transformation is from a matrix to a list of pair relations, or from a list of pair relations to an array format

lbs

(optional) the labels in the transformation

lb2lb

(optional and logical) whether the transformation is label-to-label. Default TRUE for "toarray" and FALSE for "tolist"

sep

(optional) the pair separator for the pairwise relations

ord

(optional) the order of the resulted structure ('toarray' option, otherwise ignored)

Details

'tolist' is the option to transform 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. On the other hand '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 now supported.

Data frames are also accepted for the 'tolist' option, but in case that this information is given as a list of pair relations the output will be a square matrix.

Value

Depending on the input data, the result is either a list of pair relations or a matrix of relations.

Note

For high dimensional arrays, the rel.sys function privides additional information other than the list of pair relations of the entire structure.

Author(s)

Antonio Rivero Ostoic

See Also

read.srt, bundles, reduc, rel.sys

Examples

1
2
3
4
5
## 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
transf(s, lb2lb = TRUE, lbs = c('n','m','<f1>'))

multiplex documentation built on Aug. 16, 2017, 5:12 p.m.