When I save the inspect () object in the R tm package, it prints on the screen. It saves the data that I want in data.frame, but I have thousands of documents for analysis, and printing to the screen overflows my memory.
library(tm) data("crude") matrix <- TermDocumentMatrix(corpus,control=list(removePunctuation = TRUE, stopwords=TRUE)) out= data.frame(inspect(matrix))
I tried every trick I can think of. capture.output () modifies the object (not the desired effect), like sink (). dev.off () does not work. invisible () does nothing. suppressWarnings (), suppressMessages () and try () unsurprisingly do nothing. There are no silent or silent parameters in the validation command.
The closest I can get is
out= capture.output(inspect(matrix)) out= data.frame(out)
which, in particular, does not give the same data frame, but it can be quite easy if I need to go down this route. Any other (less hacker) suggestions would be helpful. Thanks.
Windows 7 64-bit R-3.0.1 tm-package is the latest version (0.5-9.1).
source share