toRowMatrixForm: Conversion of vector/array/matrix to row-matrix form

Description Usage Arguments Warning Examples

View source: R/utils.R

Description

This function manipulates a numeric data structure of vector/array/matrix type in order to obtain a matrix representation. For 1D data structures and column/row arrays and matrices the output is turned in a matrix format with just one row. If the input structure is rectangular, instead, it is only converted in matrix format.

Usage

1

Arguments

D

a generic array, matrix or vector to be converted in row-matrix format.

Warning

The function is not supposed to work with arbitrary N-dimensional arrays.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
toRowMatrixForm( 1 : 10 )

toRowMatrixForm( array( 1 : 10, dim = c(1,10 ) ) )

toRowMatrixForm( array( 1 : 10, dim = c( 10, 1 ) ) )

toRowMatrixForm( matrix( 1 : 10, ncol = 10, nrow = 1 ) )

toRowMatrixForm( matrix( 1 : 10, ncol = 1, nrow = 10 ) )

toRowMatrixForm( matrix( 1 : 12, ncol = 3, nrow = 4 ) )

toRowMatrixForm( matrix( 1 : 12, ncol = 4, nrow = 3 ) )

roahd documentation built on Nov. 4, 2021, 1:07 a.m.