shape {salad}R Documentation

Dual objects length, dim, names and dimnames

Description

S3 methods for length, dim, names and dimnames

Usage

## S3 method for class 'dual'
length(x)

## S3 method for class 'dual'
dim(x)

## S3 replacement method for class 'dual'
dim(x) <- value

## S3 method for class 'dual'
dimnames(x)

## S3 replacement method for class 'dual'
dimnames(x) <- value

## S3 method for class 'dual'
names(x)

## S3 replacement method for class 'dual'
names(x) <- value

Arguments

x

a dual object

value

for replacement methods, the new value

Details

As the methods 'dimnames' and 'dimnanes<-.dual' have been defined, you can use 'rownames' and 'colnames' as with numeric matrices (see examples).

Value

Return values are similar to the base methods.

Examples

x <- dual( matrix(c(1,0,2,3,2,4), 2, 3) )
dim(x)
length(x)
rownames(x) <- c("L1", "L2")
x
d(x, "x1.1")

# modifying dim is the recommended way to change dual object shape
dim(x) <- NULL
x

# back to matrix shape
dim(x) <- c(2, 3)
x

[Package salad version 1.0 Index]