Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

api-pct-operations

Array algebra


Description

Addition, subtraction etc. of arrays

Usage

a1 %a+% a2

a1 %a-% a2

a1 %a*% a2

a1 %a/% a2

a1 %a/0% a2

tab1 %ap% perm

tab1 %a_% marg

tab1 %a==% tab2

tab1 %a^% extra

tab1 %aa% tab2

Arguments

tab1, tab2

Multidimensional arrays with named dimnames (we call them 'named arrays').

perm

A vector of indices or dimnames or a right hand sided formula giving the desired permutiation.

marg

A vector of indices or dimnames or a right hand sided formula giving the desired marginal.

extra

List defining the extra dimensions.

a, a1, a2

Arrays (with named dimnames)

Author(s)

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

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

gRbase

A Package for Graphical Modelling in R

v1.8-6.7
GPL (>= 2)
Authors
Søren Højsgaard <sorenh@math.aau.dk>
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.