Learn R Programming

textir (version 1.1)

freq: Frequency Matrix Conversion

Description

Convert a count matrix with observation-rows and category-columns to the corresponding frequency matrix.

Usage

freq(x)

Arguments

x
A matrix with count entries. For use with the tm package, freq will first transpose a TermDocumentMatrix.

Value

  • A matrix with row sums of one.

See Also

normalize

Examples

Run this code
freq( t(rmultinom(10, 20, c(1/2,1/4,1/8,1/8))) )

Run the code above in your browser using DataLab