| tmMap-methods {tm} | R Documentation |
Methods for function tmMap in package tm.
FUN onto each element
of object. Note that document specific metadata (i.e.,
DMetaData(object) is automatically passed to
FUN as argument DMetaData). FUN must be a
function which returns a TextDocument. If lazy is
set, so-called lazy mapping is activated, i.e., mappings are
delayed until the documents' content is accessed. Lazy mapping is
useful when working with large corpora but only a few documents
are accessed, as it avoids applying the mapping to all elements in
the corpus.Please be aware that lazy transformations are an experimental feature and change R's standard evaluation semantics.
See getTransformations for available transformations
shipped with tm. See materialize for manually
materializing lazy transformations.
data("crude")
tmMap(crude, stemDoc)
headings <- function(object, ...) {
new("PlainTextDocument", Heading(object), DateTimeStamp =
Sys.time(), ID = ID(object), Language = Language(object))
}
inspect(tmMap(crude, headings))