Please upload your final completed lab on the Assignments page in Canvas, as per the instructions below.
You are welcome and expected to ask for help from the instructors if you get stuck: Please also come to the R Bootcamp on Friday—there is coffee and snacks!
Here are some of the data from the Harry Potter movies data we have been using, as three vectors.
“Unfortunately”, as I was making these, the dog ate some of them … resulting in some missing data …
You can read these into R by copying and pasting the three lines into the Console.
year <- c(2001, 2002, 2004, 2005, 2007, 2009, 2010, 2011, 2016) prod_budget <- c(125000000, NA, 130000000, 150000000, NA, 250000000, 125000000, 125000000, 180000000) ww_boxoffice <- c(974755371, 878979634, NA, 896911078, NA, 935083686, 960283305, 1341511219, 803798342)
Create a vector identifying Which films are missing their year of release?
Which films are missing their production budget?
Which films are missing their worldwide box office?
Use mean() to calculate the mean production budget for all years that there are data.
Use mean() to calculate the mean worldwide box office for all years that there are data.
Calculate the return on investment for each film.
Calculate the mean return in investment over all films.
Please check the help page for a reminder, if you need to.