I am a novice R user hoping for some help:
I want to write some code where I can input a vector and determine how many times each item fell within a category. For example, if I had three categories in a data frame and a vector in question:
```
fruits<-c("Apple","Banana","Pear")
vegetables<-c("Broccoli","Spinach","Peas")
flowers<-c("Rose","Daisy","lily")
df<-cbind(fruits,vegetables,flowers)
df
vectorinquestion<-c("Banana","Peas","Apple")
```
What kind of code can I use to get the output of:
Fruit = 2
Vegetable = 1
Flower = 0
Any help with this would be greatly appreciated! I am trying to learn new functions, so this would help a lot.