Convert a LinkMap to a sparse matrix. Convert a LinkMap to a sparse matrix object from the Matrix package.
as.matrix.LinkMap.RdConvert a LinkMap to a sparse matrix.
Convert a LinkMap to a sparse matrix object from the Matrix package.
Arguments
- x
a
LinkMapobject.- terms
id of cols in their desired order.
c(rows, cols).- dims
length-2 integer vector of matrix dimensions. Default:
colnames(x)- dimnames
list of dimnames. (Default:
levels(x)).- value_id
Name or index of column in metadata to use as matrix values.
- force_pattern
Boolean. Whether to ignore value and return a sparse pattern matrix. (Default: FALSE)- ...
additional arguments. Not used.
Examples
x <- randomLinkMap()
as.matrix(x)
#> 26 x 26 sparse Matrix of class "ngCMatrix"
#> [[ suppressing 26 column names ‘A’, ‘B’, ‘C’ ... ]]
#> UPPER
#> lower
#> a | | | . . | | . . | | . . . . | | | | | . | | | . |
#> g | | . | . . . | | | . | . | | . | | | . | | | . . .
#> h | | . | | | | . . . | | | . | . . | . . . . . . . |
#> i | | | | | . | | | . | . | | | | | . . . | | | . . .
#> j | . | | . . . | | | | . . | | . . | | | | . . | . .
#> k | . . . | | . . . | | | . . | . . | | . | . | | . |
#> m | | . . | . . | . . . | | . | . . | . . . . | | . .
#> n | | | | | . . . . . . . . . | | . | . . . . | . | .
#> p | . | . . . | | . | . | | | . | . | . | | . . . | .
#> r | | . . | . . . | | . . . . | | | | . . | | . . | .
#> v | | | | . . | . | | . | . | . | . | . . | . . | . .
#> w | . | | . | . | . | . . | . | | | | . . | . | | | .
#> x | | . | | | . | . . | | | | | | . . . | . . . | . .
#> z | . . . . | . | | . | | . . . . . . | | . | . . | |
#> d . | . . . | . | | . . . | . . | | . | . | | . . | |
#> e . | | . | | | | | . | . . . | | . . | | | . | | | |
#> l . | | | | | | | . . . . | . . . . | . . | | | | | .
#> q . | . . . | . . . . . . | . | . . . | | . . . | . |
#> t . | . . . | . . | | | . . . | . . . . . . . | | . |
#> c . . | | . . | . . . | . | | | . . . | | | | . | | |
#> f . . | | . | | | | | | . | | . . . | | . | | | . | .
#> o . . | . . . . . | | . | | | | . | | . | | . | . . |
#> u . . | | | | . . . . | . . . | | . . | | . . . | | .
#> b . . . . | | | . . | . | | | | | | . . . | | . | | .
#> s . . . . | . . | | . | | . . | . . | | | | | | . . |
#> y . . . . | . . | . | | . | . | | . . | . . | . | | |