R/enlist.R

Defines functions enlist

Documented in enlist

#' Create named list from character vector.
#'
#' A wrapper for setNames(vector())
#'
#' @param nms (character) names for list
#'
#' @return list
#' @export
#'
#' @keywords general, lists
#'
#' @examples
#' enlist(letters)
enlist <- function(nms) {
  stopifnot(is.character(nms) && is.null(dim(nms)))
  stats::setNames(vector("list", length(nms)), nms)
}
mcfreund/mfutils documentation built on Feb. 6, 2022, 4:57 a.m.