Creates a matrix based on a vector specifying the lower diagonal elements (as would be defined in NONMEM outputs)
Arguments
- x
Vector of values to be placed in the matrix
- dimnames
Optional dimension names for output matrix
- byrow
(Optional) Should we read in the data into the matrix diagonal by row (default) or by column
Details
Places the values in the lower diagonal of an output matrix, and reflects these values across the diagonal. Adds dimension names if provided
Author
Mike K Smith mstoolkit@googlemail.com
Examples
createNmMatrix(1:3)
#> [,1] [,2]
#> [1,] 1 2
#> [2,] 2 3
createNmMatrix(1:6)
#> [,1] [,2] [,3]
#> [1,] 1 2 4
#> [2,] 2 3 5
#> [3,] 4 5 6
createNmMatrix(1:10, list(LETTERS[1:4], letters[1:4]))
#> a b c d
#> A 1 2 4 7
#> B 2 3 5 8
#> C 4 5 6 9
#> D 7 8 9 10