r count list

# Sample list
my_list <- list("apple", "banana", "orange", "apple", "grape", "banana")

# Count occurrences of each element in the list
count_result <- table(my_list)

# Display the count result
print(count_result)