addProbs | R Documentation |
Add conditional and/or marginal probabilities to a two-way contingency table.
addProbs(A, margin = seq_len(nd), fmt = "%d (%.1f%%)")
A |
matrix of typeof integer, two-dimensional contingency table. See addmargins |
margin |
integer scalar or vector, see addmargins |
fmt |
character scalar,
C-style string format with a |
Function addProbs provides the joint, marginal (using margin = 1:2
)
and conditional (using margin = 1L
or margin = 2L
)
probabilities of a two-dimensional contingency table.
Function addProbs returns an 'addProbs'
object, which inherits from table and noquote.
margin.table (which is to be renamed as marginSums) is much slower than colSums.
The use of argument margin
is
the same as addmargins,
and different from proportions!
rowSums colSums proportions
addProbs(table(warpbreaks$tension))
storage.mode(VADeaths) = 'integer'
addProbs(VADeaths)
addProbs(VADeaths, margin = 1L)
rowSums(proportions(VADeaths, margin = 1L))
addmargins(VADeaths, margin = 1L)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.