content_transformer: Content Transformers

View source: R/transform.R

content_transformerR Documentation

Content Transformers

Description

Create content transformers, i.e., functions which modify the content of an R object.

Usage

content_transformer(FUN)

Arguments

FUN

a function.

Value

A function with two arguments:

x

an R object with implemented content getter (content) and setter (content<-) functions.

...

arguments passed over to FUN.

See Also

tm_map for an interface to apply transformations to corpora.

Examples

data("crude")
crude[[1]]
(f <- content_transformer(function(x, pattern) gsub(pattern, "", x)))
tm_map(crude, f, "[[:digit:]]+")[[1]]

tm documentation built on Feb. 16, 2023, 9:40 p.m.