Created
June 12, 2018 21:20
-
-
Save jfaganUK/5be9f37476162d49cfa4e27e9f130595 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
reduce.tdm <- function(m, rs = 1, cs = 100) { | |
repeat { | |
i <- sum(dim(m)) | |
cat("Min row sum\t", min(rowSums(m)),"\tMin col sum\t",min(colSums(m)), "\n") | |
m <- m[rowSums(m) >= rs, colSums(m) >= cs] | |
if(sum(dim(m)) == i) break | |
} | |
return(m) | |
} | |
m <- reduce.tdm(m) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment