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.
This exercise is part of the course
Introduction to R
Exercise instructions
- Calculate the total revenue for the US and the non-US region and assign
total_revenue_vector
. You can use thecolSums()
function. - Print out
total_revenue_vector
to have a look at the results.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# all_wars_matrix is available in your workspace
all_wars_matrix
# Total revenue for US and non-US
total_revenue_vector <-
# Print out total_revenue_vector