#' is_named
#'
#' Does a vector have at least one name that isn't \code{NA} or \code{""}
#'
#' @param x a vector of any type
#'
#' @return \code{TRUE} or \code{FALSE}. never returns NA, so safe to use in \code{if} statements
#'
#' @export
#'
is_named <- function(x) {
is_not_null(names(x)) &&
any(names(x) != "") &&
!all(is.na(names(x)))
}
#' @rdname is_named
#' @export
is_not_named <- function(x) !is_named(x)
#' @rdname is_named
#' @export
is_named_character <- function(x) is_character(x) && is_named(x)
#' @rdname is_named
#' @export
is_named_list <- function(x) is_list(x) && is_named(x)
#' @rdname is_named
#' @export
is_named_numeric <- function(x) is_numeric(x) && is_named(x)
#' @rdname is_named
#' @export
is_named_logical <- function(x) is_logical(x) && is_named(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.