api-pct-operations function

Array algebra

Array algebra

Addition, subtraction etc. of arrays

a1 %a+% a2 a1 %a-% a2 a1 %a*% a2 a1 %a/% a2 a1 %a/0% a2 tab1 %a_% marg tab1 %a==% tab2 tab1 %a^% extra tab1 %aperm% perm tab1 %aalign% tab2 tab1 %aslice% slice tab1 %aslice*% slice tab1 %amarg% marg

Arguments

  • tab1, tab2: Multidimensional arrays with named dimnames (we call them 'named arrays').
  • marg: A vector of indices or dimnames or a right hand sided formula giving the desired marginal.
  • extra: List defining the extra dimensions.
  • perm: A vector of indices or dimnames or a right hand sided formula giving the desired permutiation.
  • slice: A list of the form name=value.
  • a, a1, a2: Arrays (with named dimnames)

Examples

hec <- HairEyeColor a1 <- tabMarg(hec, c("Hair", "Eye")) a2 <- tabMarg(hec, c("Hair", "Sex")) a3 <- tabMarg(hec, c("Eye", "Sex")) ## Binary operations a1 %a+% a2 a1 %a-% a2 a1 %a*% a2 a1 %a/% a2

Author(s)

Søren Højsgaard, sorenh@math.aau.dk