dtm_lfilter | R Documentation |
Left filter for document-term matrix structure (as provided by tm).
I.e. return a DocumentTermMatrix
for the target
dtm
documents considering all (and only) the terms in the reference
dtm, filling
with zeros the terms which are not present. Final order of token are the
same as in target
dtm_lfilter(target, reference)
target |
( |
reference |
( |
This is usefull in Machine Learning, i.e. to use a machine reference
-trained
on the target
dtm.
(DocumentTermMatrix
) with weights for the terms in
reference
and documents in target
DTMs.
tm, slam
library(tm) data(acq) data(crude) reference <- DocumentTermMatrix(acq) to_adjust <- DocumentTermMatrix(crude) dtm_lfilter(reference, to_adjust)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.