Ops.mcnode: Operations on mcnode Objects

View source: R/Ops.mcnode.R

Ops.mcnodeR Documentation

Operations on mcnode Objects

Description

Alters the way operations are performed on ‘⁠mcnode⁠’ objects for better consistency. This method is used for any of the Group Ops functions.

Usage

## S3 method for class 'mcnode'
Ops(e1, e2)

Arguments

e1

an ‘⁠mcnode⁠’ object, a vector or an array.

e2

an optional ‘⁠mcnode⁠’ object, a vector or an array.

Details

Rules (illustrated with ‘⁠+⁠’, ignoring the ‘⁠nvariates⁠’ dimension):

  • ‘⁠0 + 0 = 0⁠’; ‘⁠0 + V = V⁠’; ‘⁠0 + U = U⁠’; ‘⁠0 + VU = VU⁠’

  • ‘⁠V + V = V⁠’: if both of the same ‘⁠(nsv)⁠’ dimension

  • ‘⁠V + U = VU⁠’: U recycled "by row", V recycled "by column"

  • ‘⁠V + VU = VU⁠’: V recycled "by column"

  • ‘⁠U + U = U⁠’: if both of the same ‘⁠(nsu)⁠’ dimension

  • ‘⁠U + VU = VU⁠’: U recycled "by row"

  • ‘⁠VU + VU = VU⁠’: if dimensions are ‘⁠(nsu x nsv)⁠’

The ‘⁠outm⁠’ attribute is transferred as: ‘⁠each + each = each⁠’; ‘⁠none + other = other⁠’; ‘⁠other1 + other2 = other1⁠’.

Value

the result as a ‘⁠mcnode⁠’ object.

See Also

mcdata, mcstoc

Examples

oldvar <- ndvar()
oldunc <- ndunc()
ndvar(30)
ndunc(20)
x0 <- mcdata(3, type="0")
xV <- mcdata(1:ndvar(), type="V")
xU <- mcdata(1:ndunc(), type="U")
xVU <- mcdata(1:(ndunc()*ndvar()), type="VU")
-x0
x0 + 3
xV * x0
xV + xU
xU + xVU
ndvar(oldvar)
ndunc(oldunc)

mc2d documentation built on Oct. 23, 2026, 1:06 a.m.