create a bar graph by counting the elements in an array in r in r
# Create an arrayarray <- c("apple", "banana", "apple", "orange", "banana", "apple")
# Count the frequency of each element in the arraycounts <- table(array)
# Create a bar graphbarplot(counts, main="Frequency of Elements in Array", xlab="Elements", ylab="Frequency")