R/collect.r

Defines functions collect

Documented in collect

#' Converts a logical matrix to a list of character vectors
#'
#' This currently only supports x with only one non-zero element
#'
#' @param x      A logical matrix
#' @param along  Which axis to spread mask on
#' @return       A character vector or list thereof
#' @export
collect = function(x, along=2) {
    map(x, along=along, function(i) dimnames(x, along=along)[i])
}

Try the narray package in your browser

Any scripts or data that you put into this service are public.

narray documentation built on Oct. 2, 2022, 5:08 p.m.