Retrieve the class of the first element of a vector

get_first_element_class(input_vector)

Arguments

input_vector

A vector whose first element's class is to be retrieved.

Value

The class of the first element of the input vector.

Examples

# Get the class of the first element in a numeric vector
get_first_element_class(c(1, 2, 3)) # Returns "numeric"
#> [1] "numeric"

# Get the class of the first element in a character vector
get_first_element_class(c("apple", "banana", "cherry")) # Returns "character"
#> [1] "character"