object_has_names: Check names and rownames

View source: R/utils_object.R

object_has_namesR Documentation

Check names and rownames

Description

object_has_names() checks if specified names are present in the given object. object_has_rownames() checks if rownames are present in a dataframe.

Usage

object_has_names(x, names)

object_has_rownames(x)

Arguments

x

A named object (an atomic vector, a list, a dataframe, etc.).

names

A single character or a vector of characters.

Value

A logical or a vector of logicals.

Examples


# check if specified names are present in the given object
object_has_names(mtcars, "am")
object_has_names(anscombe, c("x1", "z1", "y1"))
object_has_names(list("x" = 1, "y" = 2), c("x", "a"))

# check if a dataframe has rownames
object_has_rownames(mtcars)


easystats/insight documentation built on Dec. 14, 2024, 12:34 p.m.