mouter()
: a generalization of outer()
library(mouter) knitr::opts_chunk$set( echo = TRUE, error = FALSE ) knitr::render_markdown(strict=FALSE)
Function mouter::mouter()
generalizes (a bit) base::outer()
so that it can be conviniently used to build joint frequency distributions from several marginal distributions.
We call mouter
with a collection of vectors and/or arrays. They will correspond to margins. Say:
# As an array a <- mouter( A = c(a=1, b=2) / 3, M = matrix(1:4 / 10, 2, 2, dimnames=list(D=letters[5:6], E=letters[7:8])), B = c(c=2, d=3) / 5, retval="a" ) str(a)
Alternatively, mouter
can return a data frame:
# Data frame mouter( A = c(a=1, b=2) / 3, M = matrix(1:4 / 10, 2, 2, dimnames=list(D=letters[5:6], E=letters[7:8])), B = c(c=2, d=3) / 5, retval="df" )
devtools::install_github("mbojan/mouter")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.