I have imported an excel spreadsheet into R studio and I need to write R commands for the data. I need a command to display how many times an item has been sold. The data looks a little something like this
PRODUCT ------------------- UNITS
eye liner ----------------------- 10
lip gloss ----------------------- 5
eye liner ----------------------- 10
lip gloss ----------------------- 5
I do not know how to count how many units of lip gloss have been sold. The best I can do is display how many times lip gloss shows up in the data with the command:
nrow(mySales[mySales$Product=="lip gloss",])
This command doesn't count how many units of lip gloss are sold which is 10, it only counts how many times lip gloss appears in the data (2). This is a beginner course and this is the first exercise, I am assuming it is a simple problem however I am completely lost.