Learn R Programming

RTextTools (version 1.4.3)

matrix_container-class: an S4 class containing the training and classification matrices.

Description

An S4 class containing all information necessary to train, classify, and generate analytics for a dataset.

Arguments

Objects from the Class

Objects could in principle be created by calls of the form new("matrix_container", ...). The preferred form is to have them created via a call to create_container.

Slots

training_matrix

Object of class "matrix.csr": stores the training set of the DocumentTermMatrix created by create_matrix

training_codes

Object of class "factor": stores the training labels for each document in the training_matrix slot of matrix_container-class

classification_matrix

Object of class "matrix.csr": stores the classification set of the DocumentTermMatrix created by create_matrix

testing_codes

Object of class "factor": if virgin=FALSE, stores the labels for each document in classification_matrix

column_names

Object of class "vector": stores the column names of the DocumentTermMatrix created by create_matrix

virgin

Object of class "logical": boolean specifying whether the classification set is virgin data (TRUE) or not (FALSE).

Examples

Run this code
# NOT RUN {
library(RTextTools)
data(NYTimes)
data <- NYTimes[sample(1:3100,size=100,replace=FALSE),]
matrix <- create_matrix(cbind(data["Title"],data["Subject"]), language="english", 
removeNumbers=TRUE, stemWords=FALSE, weighting=tm::weightTfIdf)
container <- create_container(matrix,data$Topic.Code,trainSize=1:75, testSize=76:100, 
virgin=FALSE)

container@training_matrix
container@training_codes
container@classification_matrix
container@testing_codes
container@column_names
container@virgin
# }

Run the code above in your browser using DataLab