dns2stm: Dense matrix to Simple Triplet-Matrix

View source: R/other2stm.R

dns2stmR Documentation

Dense matrix to Simple Triplet-Matrix

Description

Dense matrix to Simple Triplet-Matrix

Usage

dns2stm(dns, memory = NULL)

## S3 method for class 'data.frame'
as.simple_triplet_matrix(df, memory = NULL,
  force = FALSE)

Arguments

dns

a full dense matrix with rownames as documents and colnames as tokens

memory

(num) the maximum ammount of memory (RAM + virtual) the sistem is required to reserve for the proces. Default is to use standard R option and so provide "memory.limit()"

df

a data frame to be converted in STM

force

(lgl) flag (default = FALSE) to force the use also for non-weihted data frames

Value

an object of classes link[tm]{DocumentTermMatrix} and link[slma]{simple_triplet_matrix}

Examples

library(slam)
data("liu_dtm")
liu_full_matrix <- stm2dns(liu_dtm)
identical(liu_dtm, slam::as.simple_triplet_matrix(liu_full_matrix))

UBESP-DCTV/costumer documentation built on Feb. 1, 2023, 4:52 a.m.