Skip to contents

Normalize vector to a simplex

Usage

to_simplex(vector)

Arguments

vector

numeric vector

Value

vector whose entries sum to 1

Examples

to_simplex(c(1, 1, 1))
#> [1] 0.3333333 0.3333333 0.3333333