has_names: Check if all elements of an object are named

Description Usage Arguments Details Value Examples

View source: R/has-names.R

Description

Check if all elements of an object have non-empty names.

Usage

1

Arguments

x

[any]

An object.

Details

This function first checks if the underlying names attribute of x is NULL. If it is not, then it checks if all its elements are non-empty strings (character(1) values not equal to "").

Value

A logical(1).

Examples

1
2
3
4
5
x <- c(a = 1, b = 2, 3)
y <- c(a = 1, b = 2, c = 3)

has_names(x) # FALSE
has_names(y) # TRUE

jeanmathieupotvin/dotprofile documentation built on Dec. 20, 2021, 10:08 p.m.