1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to R

Connected

Exercise

The total box office revenue for the entire saga

Just like cbind() has rbind(), colSums() has rowSums(). Your R workspace already contains the all_wars_matrix that you constructed in the previous exercise; type all_wars_matrix to have another look. Let's now calculate the total box office revenue for the entire saga.

Instructions

100 XP
  • Calculate the total revenue for the US and the non-US region and assign total_revenue_vector. You can use the colSums()function.
  • Print out total_revenue_vector to have a look at the results.