This should be very simple, but I cannot find out how to do it.
Suppose I have the vector: ('cat', 'hat', 'hat', 'mouse').
I would like to group by each word in the vector and calculate the number of times the word occured. The output should be
'cat':1
'hat':2
'mouse':1
How do you do this in R?