matrix2: Square matrices

Description Usage Arguments Value Author(s) See Also Examples

View source: R/matrix2.R

Description

Create a square matrix from a given set of values

Usage

1
matrix2(x, stages, byrow = TRUE)

Arguments

x

a vector of matrix elements

stages

a vector of row names (also assigned to columns)

byrow

fill matrix by rows , default TRUE

Value

a square matri

Author(s)

Chris Stubben

See Also

matrix

Examples

1
2
3
4
5
6
# Centaurea corymbosa from Freville 2004
ceco <- c(0,0,5.905,0.368,0.639, 0.025, 0.001, 0.152, 0.051)
stages <- c("seedling", "vegetative", "flowering")
# shortcut for
matrix(ceco, nrow=3, byrow=TRUE, dimnames=list(stages,stages))
matrix2(ceco, stages)

popbio documentation built on March 26, 2020, 8:44 p.m.