question archive Question 2) Suppose you want to identify those actors/actresses who have appeared only in movies that lost money (where the revenue is less than the budget)
Subject:Computer SciencePrice: Bought3
Question 2) Suppose you want to identify those actors/actresses who have appeared only in movies that lost money (where the revenue is less than the budget). In other words, all the movies that an actor/actress starred in must be loss-generating movies (i.e., revenue < budget) to be included in the result. If there is even just one movie that made profit or was on a break-even point (i.e., revenue >= budget) among all the movies an actor/actress played, that actor/actress should not be included in the result. Along with the actor_ID, you want your final data frame to display the title and year of each movie he/she appeared, amount of money lost in the movie (actual_money_lost, where it is defined as budget-revenue). Assume that Actors and Movies are in your active R session and tidyverse was loaded. Complete the following code that will accomplish the above objectives. Note that for each blank, you can use the name of an appropriate function or the name of an appropriate variable (i.e., a column name). Movies2 <- Movies :>. mutate (lost money = ( revenue < budget, 1, 0)) combined <- Actors, Movies2) results <- combined .> (at_least_one = (at_least_one = = 1) :> (actual_money_lost = budget - revenue) :> select (actor_ID, title, year, actual_money_lost)
