which_names: Find indices of TRUE entries in an array

Description Usage Arguments Details Value Examples

View source: R/which_names.R

Description

base::which() returns numeric indices of TRUE entries in an array. This wrapper uses dimnames to return pairs of row/column names.

Usage

1

Arguments

.a

array

dimnames

list of character vectors. E.g., if .a is a matrix, then length(dimnames) == 2, dimnames[[1]] is a vector of row names, and dimnames[[2]] is a vector of column names.

...

Additional options passed to base::which().

Details

This was originally created to examine correlation matrices for collinearity. Then I discovered corrr::stretch() and that was much better.

Value

a data frame of named indices

Examples

1
2
which_names(mtcars[1:6, c("vs", "am")] == 1)
which_names(matrix(1:20, nrow = 4) %% 3 == 0)

anchorlytics/anchorUtils documentation built on Oct. 16, 2020, 7:11 p.m.