R: Convenience function to check presence of a named element

has_name {tibble} | R Documentation

## Convenience function to check presence of a named element

### Description

This function returns a logical value that indicates if a data frame or another named object contains an element with a specific name.

### Usage

    has_name(x, name)

### Arguments

`x` | A data frame or another named object
`name` | Element name(s) to check

### Details

Unnamed objects are treated as if all names are empty strings. `NA` input gives `FALSE` as output.

### Value

A logical vector of the same length as `name`

### Examples

    has_name(iris, "Species")
    has_name(mtcars, "gears")

[Package tibble version 1.3.0 Index]