Skip to contents

stm_zeros_like() generates a matrix or vector of zeros that matches the dimensions of the provided input matrix or vector.

Usage

stm_zeros_like(vmat)

Arguments

vmat

A matrix or vector whose dimensions will be used to generate the matrix or vector of zeros.

Value

A matrix or vector of the same dimensions as vmat, filled with zeros.

Details

The function checks the validity of the input vmat, converting it to a matrix if it is a vector. It then generates a matrix of zeros of the same size as vmat.

See also

Examples

A <- matrix(1:12, nrow = 3, byrow = TRUE)
stm_zeros_like(A)
#>      [,1] [,2] [,3] [,4]
#> [1,]    0    0    0    0
#> [2,]    0    0    0    0
#> [3,]    0    0    0    0
stm_zeros_like(c(1, 2, 3))
#>      [,1]
#> [1,]    0
#> [2,]    0
#> [3,]    0