Created
September 11, 2016 21:12
-
-
Save zunman/e253ea6dc5fddce771b9da538c019578 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create the Document-Term matrix | |
DTM <- DocumentTermMatrix(MyCorpus, control = list(bounds = list(global = c(0, Inf)))) | |
dim(DTM) | |
# Create a sparse matrix to put into SVM | |
sparse_DTM <- sparseMatrix(i = DTM$i, j = DTM$j, x = DTM$v, | |
dims = dim(DTM), | |
dimnames = list(rownames(DTM), colnames(DTM))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment