subset.dsm | R Documentation |
Filter the rows and/or columns of a DSM object according to user-specified conditions.
## S3 method for class 'dsm' subset(x, subset, select, recursive = FALSE, drop.zeroes = FALSE, matrix.only = FALSE, envir = parent.frame(), run.gc = FALSE, ...)
x |
an object of class |
subset |
Boolean expression or index vector selecting a subset of the rows; the expression can use variables |
select |
Boolean expression or index vector selecting a subset of the columns; the expression can use variables |
recursive |
if |
drop.zeroes |
if |
matrix.only |
if |
envir |
environment in which the |
run.gc |
whether to run the garbage collector after each iteration of a recursive subset ( |
... |
any further arguments are silently ignored |
An object of class dsm
containing the specified subset of the model x
.
If necessary, counts of nonzero elements for each row and/or column are updated automatically.
Stephanie Evert (https://purl.org/stephanie.evert)
dsm
print(DSM_TermContext$M) model <- DSM_TermContext subset(model, nchar(term) <= 4)$M # short target terms subset(model, select=(nnzero <= 3))$M # columns with <= 3 nonzero cells subset(model, nchar(term) <= 4, nnzero <= 3)$M # combine both conditions subset(model, nchar(term) <= 4, nnzero >= 2)$M # still three columns with nnzero < 2 subset(model, nchar(term) <= 4, nnzero >= 2, recursive=TRUE)$M
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.