Problem 1.15

library(fosdata)
head(bechdel)
##   year      imdb            title            test clean_test binary   budget
## 1 2013 tt1711425    21 & Over          notalk     notalk   FAIL 1.30e+07
## 2 2012 tt1343727         Dredd 3D     ok-disagree         ok   PASS 4.50e+07
## 3 2013 tt2024544 12 Years a Slave notalk-disagree     notalk   FAIL 2.00e+07
## 4 2013 tt1272878           2 Guns          notalk     notalk   FAIL 6.10e+07
## 5 2013 tt0453562               42             men        men   FAIL 4.00e+07
## 6 2013 tt1335975         47 Ronin             men        men   FAIL 2.25e+08
##   domgross  intgross     code budget_2013 domgross_2013 intgross_2013
## 1 25682380  42195766 2013FAIL    13000000      25682380      42195766
## 2 13414714  40868994 2012PASS    45658735      13611086      41467257
## 3 53107035 158607035 2013FAIL    20000000      53107035     158607035
## 4 75612460 132493015 2013FAIL    61000000      75612460     132493015
## 5 95020213  95020213 2013FAIL    40000000      95020213      95020213
## 6 38362475 145803842 2013FAIL   225000000      38362475     145803842
##   period_code decade_code
## 1           1           1
## 2           1           1
## 3           1           1
## 4           1           1
## 5           1           1
## 6           1           1

a.) sums the amount of movies that pass the bechdel test

movies_pass <- sum(bechdel$binary == "PASS")
movies_pass
## [1] 803

b.) This finds the total length of section, and finds a percentage of movies that pass the test.

total_movies <- length(bechdel$binary)
percent_movies <- movies_pass/total_movies*100
percent_movies
## [1] 44.76031

c.) This creates a table of years and movies

year <- table(bechdel$year)
year
## 
## 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 
##    1    5    3    5    7    5    8    7    8    5   14    9   14    5   16   10 
## 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 
##   10   14   19   14   15   13   20   16   26   36   42   51   62   56   63   64 
## 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 
##   80   64   81  100   90   73  101  124  129  124   86   99

d.) This finds the year which has the most movies

most_movies <- which.max(year)
most_movies
## 2010 
##   41

e.) Finds how many variables are in clean test

var <- nlevels(bechdel$clean_test)
var
## [1] 5

f.) creates a data set for all the movies that pass the test

pass <- (bechdel$biniary == "PASS")
data <- data.frame(bechdel[(bechdel$binary == "PASS"),])
head(data)
##    year      imdb                title        test clean_test binary  budget
## 2  2012 tt1343727             Dredd 3D ok-disagree         ok   PASS 4.5e+07
## 8  2013 tt2194499           About Time ok-disagree         ok   PASS 1.2e+07
## 9  2013 tt1814621            Admission          ok         ok   PASS 1.3e+07
## 11 2013 tt1800241      American Hustle ok-disagree         ok   PASS 4.0e+07
## 12 2013 tt1322269 August: Osage County          ok         ok   PASS 2.5e+07
## 13 2013 tt1559547  Beautiful Creatures          ok         ok   PASS 5.0e+07
##     domgross  intgross     code budget_2013 domgross_2013 intgross_2013
## 2   13414714  40868994 2012PASS    45658735      13611086      41467257
## 8   15323921  87324746 2013PASS    12000000      15323921      87324746
## 9   18007317  18007317 2013PASS    13000000      18007317      18007317
## 11 148430908 249484909 2013PASS    40000000     148430908     249484909
## 12  37304874  50304874 2013PASS    25000000      37304874      50304874
## 13  19452138  55940671 2013PASS    50000000      19452138      55940671
##    period_code decade_code
## 2            1           1
## 8            1           1
## 9            1           1
## 11           1           1
## 12           1           1
## 13           1           1

g.) Removes all NAs from dom gross and place it in a data set

NAs_removed <- bechdel[!is.na(bechdel$domgross),]
head(NAs_removed)
##   year      imdb            title            test clean_test binary   budget
## 1 2013 tt1711425    21 &amp; Over          notalk     notalk   FAIL 1.30e+07
## 2 2012 tt1343727         Dredd 3D     ok-disagree         ok   PASS 4.50e+07
## 3 2013 tt2024544 12 Years a Slave notalk-disagree     notalk   FAIL 2.00e+07
## 4 2013 tt1272878           2 Guns          notalk     notalk   FAIL 6.10e+07
## 5 2013 tt0453562               42             men        men   FAIL 4.00e+07
## 6 2013 tt1335975         47 Ronin             men        men   FAIL 2.25e+08
##   domgross  intgross     code budget_2013 domgross_2013 intgross_2013
## 1 25682380  42195766 2013FAIL    13000000      25682380      42195766
## 2 13414714  40868994 2012PASS    45658735      13611086      41467257
## 3 53107035 158607035 2013FAIL    20000000      53107035     158607035
## 4 75612460 132493015 2013FAIL    61000000      75612460     132493015
## 5 95020213  95020213 2013FAIL    40000000      95020213      95020213
## 6 38362475 145803842 2013FAIL   225000000      38362475     145803842
##   period_code decade_code
## 1           1           1
## 2           1           1
## 3           1           1
## 4           1           1
## 5           1           1
## 6           1           1

h.) Pulls the movie from the list and states why it failed or passed

step_brothers <- bechdel[(bechdel$title == "Step Brothers" & (bechdel$binary== "FAIL" | bechdel$binary == "PASS")),]
step_brothers
##     year      imdb         title            test clean_test binary  budget
## 627 2008 tt0838283 Step Brothers notalk-disagree     notalk   FAIL 6.5e+07
##      domgross  intgross     code budget_2013 domgross_2013 intgross_2013
## 627 100468793 128468793 2008FAIL    70346660     108732985     139036162
##     period_code decade_code
## 627           2           2
clean <- (step_brothers$clean_test)
clean
## [1] notalk
## Levels: dubious men notalk nowomen ok