as_matrix_dsm: Extract Matrix from DSM Object (wordspace)

as.matrix.dsmR Documentation

Extract Matrix from DSM Object (wordspace)

Description

Extract the co-occurrence or score matrix from a DSM object.

Usage


## S3 method for class 'dsm'
as.matrix(x, what = c("auto", "M", "S"), ...)

Arguments

x

an object of class dsm

what

whether to extract the raw co-occurrence matrix (M) or the score matrix (S). The default option auto prefers the score matrix if both are available.

...

any additional arguments are ignored

Details

This function ensures that the row and column names of the matrix are consistent with the row/column information tables of the DSM. For faster access to the matrix, simply use x$M or x$S directly.

Value

Either the raw co-occurrence matrix or the score matrix of the DSM x.

Note that unlike other as.matrix methods, a sparse matrix in canonical DSM format may be returned.

Author(s)

Stephanie Evert (https://purl.org/stephanie.evert)

See Also

dsm, dim.dsm, dimnames.dsm, dsm.is.canonical

Examples

as.matrix(DSM_TermTerm)
as.matrix(DSM_TermContext)

wordspace documentation built on Aug. 23, 2022, 1:06 a.m.