mind: subsets matrices, keeping the dimensionality intact

Description Usage Arguments Value

Description

When you subset a matrix or data frame and the condition ends up only grabbing one row, R returns a vector instead of a matrix with one row. This function returns a matrix with one row.

Usage

1
mind(x, rows = NULL, cols = NULL)

Arguments

x

the matrix or data frame to subset

rows

either a vector of row indicies or a logical vector giving which rows to select from x

cols

either a vector of column indicies or a logical vector giving which rows to select from x

Value

a matrix subsetted to include only the rows and columns indicated but with its dimensionality preserved.


flynnzac/kiam documentation built on May 14, 2019, 12:09 p.m.