Learn R Programming

kerntools (version 1.2.0)

TSS: Total Sum Scaling

Description

This function transforms a dataset from absolute to relative frequencies (by row or column).

Usage

TSS(X, rows = TRUE)

Value

A relative frequency matrix or data.frame with the same dimension than X.

Arguments

X

Numeric matrix or data.frame of any size containing absolute frequencies.

rows

If TRUE, the operation is done by row; otherwise, it is done by column. (Defaults: TRUE).

Examples

Run this code
dat <- matrix(rnorm(50),ncol=5,nrow=10)
TSS(dat) #It can be checked that, after scaling, the sum of each row is equal to 1.

Run the code above in your browser using DataLab