Learn R Programming

tm (version 0.3-1)

WeightFunction: Weighting Function Constructor

Description

Constructs a weighting function for term-document matrices.

Usage

WeightFunction(object, name)

Arguments

object
A function which takes a dgCMatrix term-document matrix with term frequencies as input, weights the elements, and returns the weighted matrix.
name
A character naming the weighting function

Value

  • An S4 object of class WeightFunction which extends the class function representing a weighting function.

Examples

Run this code
weightCutBin <- WeightFunction(function(m, cutoff) as(m > cutoff, "dgCMatrix"), "binary with cutoff")

Run the code above in your browser using DataLab