In R, type the one line that adds a share column to orders — each amount as a fraction of the quarter's total amount.
In R, type the one line that adds a share column to orders — each amount as a fraction of the quarter's total amount.
Answer
ordersshare <- ordersamount / sum(orders$amount)
Assigning to a column name that does not exist creates it. sum() is one number recycled against all twelve; order 1005 gets 1320 / 6140 = 0.2149837.