DSArray: DSArray constructor

Description Usage Arguments Details Value Dimnames Author(s) See Also Examples

Description

Construct a DSArray from a 3-dimensional array, a matrix, or a list of matrix objects with identical dimensions.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
DSArray(x, ...)

## S4 method for signature 'matrix'
DSArray(x, dimnames = NULL)

## S4 method for signature 'list'
DSArray(x, dimnames = NULL)

## S4 method for signature 'array'
DSArray(x, MARGIN = 2L, dimnames = NULL)

## S4 method for signature 'missing'
DSArray(x, ...)

Arguments

x

A 3-dimensional array, a list of matrix objects with identical dimensions, or a matrix.

...

Further arguments passed to other methods

dimnames

A dimnames attribute for the DSArray: NULL or a list of length 3. An empty list is treated as NULL, a list of length one as row names, and a list of length two as row names and column names. If NULL, the dimnames are constructed from x; see 'Dimnames' below.

MARGIN

An integer given the dimension number that indexes samples; see Examples. The default, MARGIN = 2, corresponds to columns of x indexing samples.

Details

The difference between calling DSArray() without any arguments and calling new("DSArray") is like the difference between calling array() and calling new("array"); using the explicit constructor is to be preferred.

Value

A DSArray object.

Dimnames

If the dimnames argument to the DSArray constructor is NULL then the dimnames of the returned DSArray object are constructed as follows:

Author(s)

Peter Hickey

See Also

DSArray-class

Examples

1
2
3
4
5
6
7
# Constructing a DSArray from matrix input
m <- matrix(1:10, ncol = 2, dimnames = list(letters[1:5], LETTERS[1:2]))
m
m_dsa <- DSArray(m)
m_dsa
# Supplying alternate dimnames
DSArray(m, dimnames = list(rownames(m), "sample-1", colnames(m)))

PeteHaitch/DSArray documentation built on May 8, 2019, 1:30 a.m.