Skip to contents

Returns a pair of integers for the number of rows and columns of a matrix-like object. If the input is NULL, returns NA for both values.

Usage

safe_dim(x)

Arguments

x

A matrix/data.frame/Matrix object or NULL.

Value

Integer vector of length 2: c(nrow, ncol), or c(NA_integer_, NA_integer_) if x is NULL.