Learn R Programming

vvauditor (version 0.7.0)

get_first_element_class: Retrieve the class of the first element of a vector

Description

Retrieve the class of the first element of a vector

Usage

get_first_element_class(input_vector)

Value

The class of the first element of the input vector.

Arguments

input_vector

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

Examples

Run this code
# Get the class of the first element in a numeric vector
get_first_element_class(c(1, 2, 3)) # Returns "numeric"

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

Run the code above in your browser using DataLab