matrix {salad} | R Documentation |
Methods for 'matrix', 'array', 'as.matrix' and 'as.vector'
Description
Methods for 'matrix', 'array', 'as.matrix' and 'as.vector'
Usage
## S4 method for signature 'dual'
matrix(data = NA, nrow = 1, ncol = 1, byrow = FALSE, dimnames = NULL)
## S4 method for signature 'dual'
array(data = NA, dim = length(data), dimnames = NULL)
## S3 method for class 'dual'
as.matrix(x, ...)
## S4 method for signature 'dual'
as.matrix(x, ...)
## S3 method for class 'dual'
as.vector(x, mode = "any")
## S4 method for signature 'dual'
as.vector(x, mode = "any")
Arguments
data , x |
A dual object |
nrow |
the desired number of rows |
ncol |
the desired number of cols |
byrow |
if 'TRUE' the matrix is filled by rows |
dimnames |
A 'dimnames' attributes for a matrix or an array |
dim |
A 'dim' attributes for an array |
... |
additional arguments (ignored) |
mode |
The mode of the vector to create |
Details
The default behaviour for 'as.matrix' dans 'as.vector' is to drop the derivatives. This can be modified using 'salad' (to use with care). The prefered method to change the shape is to use 'dim<-'.
Value
A dual object for 'matrix' and 'array', a base object for 'as.matrix' and 'as.vector'.
See Also
Examples
x <- dual(c(1,2,0,4))
y <- matrix(x, 2, 2)
y
as.matrix(y)
dim(x) <- c(2,2)
x
[Package salad version 1.0 Index]