I have the following data.frame, call it Fruits
fruit amount
1 apple 5
2 cherry 6
3 kiwi 20
4 banana 4
5 orange 12
I also have the following event
>G
[1] "apple" "kiwi" "orange"
How can I find the total amount by iterating over each fruit in G is my question?
I understand that Fruits[1, 2] gives me 5 (column 2 row 1) but how do I use that to do what I need?