Skip to content

Instantly share code, notes, and snippets.

@willkurt
Created October 7, 2014 22:45
Show Gist options
  • Save willkurt/e7ddafca09295f13327a to your computer and use it in GitHub Desktop.
Save willkurt/e7ddafca09295f13327a to your computer and use it in GitHub Desktop.
DTM -> Sparse matrix
dtm.to.sm <- function(dtm){
sparseMatrix(i=dtm$i, j=dtm$j,x=dtm$v,
dims=c(dtm$nrow, dtm$ncol))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment