diag {salad} | R Documentation |
Matrix diagonals
Description
Methods extending to dual objects the corresponding methods for numeric objects.
Usage
diag.dual(x, nrow, ncol, names = TRUE)
## S4 method for signature 'dual'
diag(x = 1, nrow, ncol, names = TRUE)
## S4 replacement method for signature 'dual,dual'
diag(x) <- value
## S4 replacement method for signature 'dual,numericOrArray'
diag(x) <- value
Arguments
x |
a dual object |
nrow , ncol |
(optional) dimensions of result |
names |
if 'TRUE', pass names along |
value |
replacement value |
Value
A dual object, similarly to 'base::diag'
Examples
x <- dual( c(1,2) )
diag(x)
d(diag(x), "x1")
y <- matrix(x, 2, 2)
diag(y) <- 2*diag(y)
y
d(y)
diag(y)
[Package salad version 1.0 Index]