miniclo: miniclo

Description Usage Arguments Value Examples

View source: R/weighted_ILR.R

Description

small function to close (aka normalize by proportions, aka total sum scaling) a dataset to a constant k (usually taken to be 1). After closure the row sums of the dataset should sum to k.

Usage

1
miniclo(c, k = 1)

Arguments

c

dataset to be closed

k

closure constant

Value

matrix (if c is a vector or matrix) or data.frame (if c is a data.frame)

Examples

1
2
3
c <- matrix(c(1,2,3,1,2,3,1,2,3), nrow = 3, byrow=TRUE)
miniclo(c)
miniclo(c, k=2)

Example output

          [,1]      [,2] [,3]
[1,] 0.1666667 0.3333333  0.5
[2,] 0.1666667 0.3333333  0.5
[3,] 0.1666667 0.3333333  0.5
          [,1]      [,2] [,3]
[1,] 0.3333333 0.6666667    1
[2,] 0.3333333 0.6666667    1
[3,] 0.3333333 0.6666667    1

philr documentation built on Nov. 8, 2020, 5:38 p.m.