find data types in list r

# Create a list with different data types
my_list <- list(1, "hello", TRUE, 3.14, c(1, 2, 3), list("a", "b"))

# Use sapply to determine the data type of each element in the list
data_types <- sapply(my_list, typeof)

# Print the data types
print(data_types)