I have a dataframe in R that includes a column for "fruit name" and whether the fruit is "available" or not, with the value '1' for the fruit being available and the value '0' if the fruit is not available:
Fruit Available
Apple 0
Apple 1
Apple 1
Banana 1
Banana 0
Pear 1
Pear 0
Guava 0
I want to find the frequency of all these fruits and also find the number of times the fruit was "available" i.e. for the above table, i want the output to be like this:
Fruit frequency Total_Availability
Apple 3 2
Banana 2 1
Pear 2 1
Guava 1 0