fractionize_byname {matsbyname} | R Documentation |
Compute fractions of matrix entries
Description
This function divides all entries in a
by the specified sum,
thereby "fractionizing" the matrix.
Usage
fractionize_byname(a, margin, inf_becomes = .Machine$double.xmax)
Arguments
a |
The matrix to be fractionized. |
margin |
If |
inf_becomes |
A value to be substitute for any |
Value
A fractionized matrix of same dimensions and same row and column types as a
.
Examples
M <- matrix(c(1, 5,
4, 5),
nrow = 2, ncol = 2, byrow = TRUE,
dimnames = list(c("p1", "p2"), c("i1", "i2"))) %>%
setcoltype("Products") %>% setrowtype("Industries")
fractionize_byname(M, margin = c(1,2))
fractionize_byname(M, margin = 1)
fractionize_byname(M, margin = 2)
[Package matsbyname version 0.6.10 Index]