<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/gender-diversity-in-the-tv-series-industry/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://www.mango-solutions.com/blog/gender-diversity-in-the-tv-series-industry"> RBlog – Mango Solutions</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>In a <a rel="nofollow" href="https://www.mango-solutions.com/blog/gender-diversity-in-the-film-industry" target="_blank">previous post</a>, I studied gender diversity in the film industry, I did this by focusing on some key behind-the-camera roles and measuring the evolution of the gender diversity in the last decade. The conclusion was not great: women are under-represented, especially in the most important roles of directors and writers, as these key roles determine the way women are portrayed in front of the camera.</p>
<p>I was curious about the TV series industry too: as the TV series industry is faster paced than the movie industry<strong>, might they might be more open to women?</strong> I decided to have a look.</p>
<p>In this post, as in the <a rel="nofollow" href="https://www.mango-solutions.com/blog/gender-diversity-in-the-film-industry" target="_blank">film industry</a> post, the behind-the-camera roles I studied were: <strong>directors</strong>, <strong>writers</strong>, <strong>producers</strong>, <strong>sound teams</strong>, <strong>music teams</strong>, <strong>art teams</strong>, <strong>makeup teams</strong> and <strong>costume teams</strong>.</p>
<p>The whole code to reproduce the following results is available on <a rel="nofollow" href="https://github.com/MangoTheCat/Gender-diversity-series-industry" target="_blank"><code>GitHub</code></a>.</p>
<h3>Data Frame Creation – Web Scraping</h3>
<p>All the data I used was gathered from the <strong>IMDb website</strong>: I went through the <a rel="nofollow" href="https://www.imdb.com/chart/tvmeter?sort=rk,asc&mode=simple&page=1" target="_blank"><code>100 Most Popular TV Shows</code></a> (according to the IMDb ratings), and gathered some useful information about these 100 series: I built a data frame which contains the titles of these series, their years of release and their IMDb episode links – the link where we can find all the episodes of a series.</p>
<pre><code><span># IMDb 100 most popular TV shows ------------------------------</span>

url &lt;- <span>&quot;https://www.imdb.com/chart/tvmeter?sort=us,desc&amp;mode=simple&amp;page=1&quot;</span>
page &lt;- read_html(url)

serie_nodes &lt;- html_nodes(page, <span>'.titleColumn'</span>) %>%
  as_list()

<span># Series details</span>
serie_name &lt;- c()
serie_link &lt;- c()
serie_year &lt;- c()
<span>for</span> (i <span>in</span> seq_along(serie_nodes)){
  serie_name &lt;- c(serie_name, serie_nodes[[i]]$a[[<span>1</span>]])
  serie_link &lt;- c(serie_link, attr(serie_nodes[[i]]$a, <span>&quot;href&quot;</span>))
  serie_year &lt;- c(serie_year, serie_nodes[[i]]$span[[<span>1</span>]])
}
serie_link &lt;- paste0(<span>&quot;http://www.imdb.com&quot;</span>,serie_link)
serie_year &lt;- gsub(<span>&quot;[()]&quot;</span>, <span>&quot;&quot;</span>, serie_year)
serie_episodelist &lt;- sapply(strsplit(serie_link, split=<span>'?'</span>, fixed=<span>TRUE</span>),
                            <span>function</span>(x) (x[<span>1</span>])) %>%
  paste0(<span>&quot;episodes?ref_=tt_eps_yr_mr&quot;</span>)


<span># Create dataframe ----------------------------------------------</span>
top_series &lt;- data.frame(serie_name, serie_year, serie_episodelist, stringsAsFactors = <span>FALSE</span>)


<span># series_year was the date of 1st release but we needed the years of release for all the episodes</span>
<span># I did not manage to gather this information by doing some web scraping.</span>
<span># I added it manually as it is available on the IMDb episodes links (column serie_episodelist)</span></code></pre>
<pre><code>top_series[<span>20</span>:<span>30</span>, ]</code></pre>
<pre><code>##                        serie_name       serie_year
## 20                         Legion             2017
## 21 A Series of Unfortunate Events       2017, 2018
## 22                       Timeless 2016, 2017, 2018
## 23                      Westworld       2016, 2018
## 24                      Luke Cage             2016
## 25                       MacGyver 2016, 2017, 2018
## 26                  Lethal Weapon 2016, 2017, 2018
## 27            Designated Survivor 2016, 2017, 2018
## 28                           Bull 2016, 2017, 2018
## 29                     This Is Us 2016, 2017, 2018
## 30                        Atlanta       2016, 2018
##                                                 serie_episodelist
## 20 http://www.imdb.com/title/tt5114356/episodes?ref_=tt_eps_yr_mr
## 21 http://www.imdb.com/title/tt4834206/episodes?ref_=tt_eps_yr_mr
## 22 http://www.imdb.com/title/tt5511582/episodes?ref_=tt_eps_yr_mr
## 23 http://www.imdb.com/title/tt0475784/episodes?ref_=tt_eps_yr_mr
## 24 http://www.imdb.com/title/tt3322314/episodes?ref_=tt_eps_yr_mr
## 25 http://www.imdb.com/title/tt1399045/episodes?ref_=tt_eps_yr_mr
## 26 http://www.imdb.com/title/tt5164196/episodes?ref_=tt_eps_yr_mr
## 27 http://www.imdb.com/title/tt5296406/episodes?ref_=tt_eps_yr_mr
## 28 http://www.imdb.com/title/tt5827228/episodes?ref_=tt_eps_yr_mr
## 29 http://www.imdb.com/title/tt5555260/episodes?ref_=tt_eps_yr_mr
## 30 http://www.imdb.com/title/tt4288182/episodes?ref_=tt_eps_yr_mr</code></pre>
<p>The <code>series_year</code> column often contains several years. For example, for the series called “This is us”, it means that episodes have been released in 2016, 2017 and 2018. This column will allow me to split the episodes by year of release, and then visualise the gender diversity of the crew for each year.</p>
<div>
<h3>List Creation – Web Scraping</h3>
<p>At this stage, I just had some global information on the 100 series. The next step was to go through the IMDb links gathered in the column <code>series_episodelist</code> of my <code>top_series</code> data frame, which gives me access to all the series episodes split by year of release. I did some <strong>web scraping</strong> on these links and built a list which gathered:</p>
<ul>
<li>the names of the 100 most popular TV shows</li>
<li>for each series, the different years of release</li>
<li>for each year, the names of the episodes which have been released</li>
<li>for each episode, the names of the people whose job was included in one of the categories I listed above (directors, writers, …, costume teams)</li>
</ul>
<pre><code><span>### Create series list</span>

series_list &lt;- list()

<span># FOCUS ON EACH SERIES -----------------------------------------------------------------</span>
<span>for</span> (r <span>in</span> seq_len(nrow(top_series))) { 
  
  serie_name &lt;- top_series[r, <span>&quot;serie_name&quot;</span>]
  print(serie_name)
  
  <span># Years of release for each serie</span>
  list_serieyear &lt;- as.list(strsplit(top_series[r, <span>&quot;serie_year&quot;</span>], split = <span>&quot;, &quot;</span>)[[<span>1</span>]]) 
  <span># List of IMDb links where we find all the episodes per year of release</span>
  link_episodelist_peryear &lt;- list() 
  
  episodes_list_peryear &lt;- list()
  
  <span># FOCUS ON EACH YEAR OF REALEASE FOR THIS SERIE -------------------------------------</span>
  <span>for</span> (u <span>in</span> seq_along(list_serieyear)){ 

    year &lt;- list_serieyear[[u]]
    print(year)
    
    link_episodelist_yeari &lt;- strsplit(top_series[r, <span>&quot;serie_episodelist&quot;</span>], split=<span>'?'</span>, fixed=<span>TRUE</span>)[[<span>1</span>]][<span>1</span>] %>%
      paste0(<span>&quot;?year=&quot;</span>, year, collapse = <span>&quot;&quot;</span>)
    link_episodelist_peryear[[u]] &lt;- link_episodelist_yeari
    
    <span># FOCUS ON EACH EPISODE FOR THIS YEAR OF RELEASE ----------------------------------</span>
    <span>for</span> (l <span>in</span> seq_along(link_episodelist_peryear)){ 
      
      page &lt;- read_html(link_episodelist_peryear[[l]]) 
      episodes_nodes &lt;- html_nodes(page, <span>'.info'</span>) %>%
        as_list()
      
      episode_name &lt;- c()
      episode_link &lt;- c()
      
      <span>for</span> (t <span>in</span> seq_along(episodes_nodes)){
        episode_name &lt;- c(episode_name, episodes_nodes[[t]]$strong$a[[<span>1</span>]])
        episode_link &lt;- c(episode_link, attr(episodes_nodes[[t]]$strong$a, <span>&quot;href&quot;</span>))
      }
      
      episode_link &lt;- paste0(<span>&quot;http://www.imdb.com&quot;</span>,episode_link)
      episode_link &lt;- sapply(strsplit(episode_link, split=<span>'?'</span>, fixed=<span>TRUE</span>), 
                             <span>function</span>(x) (x[<span>1</span>])) %>%
        paste0(<span>&quot;fullcredits?ref_=tt_ql_1&quot;</span>)
      
      episode_name &lt;- sapply(episode_name, 
                             <span>function</span>(x) (gsub(pattern = <span>&quot;\\#&quot;</span>, replacement = <span>&quot;&quot;</span>, x)))  %>% <span># some names = &quot;Episode #1.1&quot;</span>
        as.character()
      
      <span># GATHER THE NAME OF THE EPISODE, ITS YEAR OF RELEASE AND ITS FULL CREW LINK ----</span>
      episodes_details_peryear &lt;- data.frame(year = year,
                                             episode_name = episode_name,
                                             episode_link = episode_link,
                                             stringsAsFactors = <span>FALSE</span>)
    }
    
    <span># FOCUS ON EACH FULL CREW LINK ----------------------------------------------------</span>
    <span>for</span> (e <span>in</span> seq_len(nrow(episodes_details_peryear))){
      
      print(episodes_details_peryear[e, <span>&quot;episode_link&quot;</span>])
      
      episode_page &lt;- read_html(episodes_details_peryear[e, <span>&quot;episode_link&quot;</span>])
      episode_name &lt;- episodes_details_peryear[e, <span>&quot;episode_name&quot;</span>]
      
      <span># GATHER ALL THE CREW NAMES FOR THIS EPISODE -------------------------------------</span>
      episode_allcrew &lt;- html_nodes(episode_page, <span>'.name , .dataHeaderWithBorder'</span>) %>%
        html_text()
      episode_allcrew &lt;- gsub(<span>&quot;[\n]&quot;</span>, <span>&quot;&quot;</span>, episode_allcrew) %>%
        trimws() <span>#Remove white spaces </span>
      
      <span># SPLIT ALL THE CREW NAMES BY CATEGORY -------------------------------------------</span>
      episode_categories &lt;- html_nodes(episode_page, <span>'.dataHeaderWithBorder'</span>) %>%
        html_text()
      episode_categories &lt;- gsub(<span>&quot;[\n]&quot;</span>, <span>&quot;&quot;</span>, episode_categories) %>%
        trimws() <span>#Remove white spaces</span>
      
      <span>## MUSIC DEPT -----------------------------------------------------------------------</span>
      episode_music &lt;- c()
      <span>for</span> (i <span>in</span> <span>1</span>:(length(episode_allcrew)-<span>1</span>)){
        <span>if</span> (grepl(<span>&quot;Music by&quot;</span>, episode_allcrew[i])){
          j &lt;- <span>1</span>
          <span>while</span> (! grepl(episode_allcrew[i], episode_categories[j])){
            j &lt;- j+<span>1</span>
          }
          k &lt;- i+<span>1</span>
          <span>while</span> (! grepl(episode_categories[j+<span>1</span>], episode_allcrew[k])){
            episode_music &lt;- c(episode_music, episode_allcrew[k])
            k &lt;- k+<span>1</span>
          }
        }
      }
      <span>for</span> (i <span>in</span> <span>1</span>:(length(episode_allcrew)-<span>1</span>)){
        <span>if</span> (grepl(<span>&quot;Music Department&quot;</span>, episode_allcrew[i])){
          <span># Sometimes music dept is last category</span>
          <span>if</span> (grepl (<span>&quot;Music Department&quot;</span>, episode_categories[length(episode_categories)])){ 
            first &lt;- i+<span>1</span>
            <span>for</span> (p <span>in</span> first:length(episode_allcrew)) {
              episode_music &lt;- c(episode_music, episode_allcrew[p])
            }
          } <span>else</span> {
            j &lt;- <span>1</span>
            <span>while</span> (! grepl(episode_allcrew[i], episode_categories[j])){
              j &lt;- j+<span>1</span>
            }
            k &lt;- i+<span>1</span>
            <span>while</span> (! grepl(episode_categories[j+<span>1</span>], episode_allcrew[k])){
              episode_music &lt;- c(episode_music, episode_allcrew[k])
              k &lt;- k+<span>1</span>
            }
          }
        }
      }
      <span>if</span> (length(episode_music) == <span>0</span>){
        episode_music &lt;- c(<span>&quot;&quot;</span>)
      }
      
      <span>## IDEM FOR OTHER CATEGORIES ----------------------------------------------------------</span>
      
      <span>## EPISODE_INFO CONTAINS THE EPISODE CREW NAMES ORDERED BY CATEGORY -------------------</span>
      episode_info &lt;- list()
      episode_info$directors &lt;- episode_directors
      episode_info$writers &lt;- episode_writers
      episode_info$producers &lt;- episode_producers
      episode_info$sound &lt;- episode_sound
      episode_info$music &lt;- episode_music
      episode_info$art &lt;- episode_art
      episode_info$makeup &lt;- episode_makeup
      episode_info$costume &lt;- episode_costume
      
      <span>## EPISODES_LIST_PER_YEAR GATHERS THE INFORMATION FOR EVERY EPISODE OF THE SERIE-------</span>
      <span>## SPLIT BY YEAR OF RELEASE --------------------------------------------------------</span>
      episodes_list_peryear[[year]][[episode_name]] &lt;- episode_info
    }
    
    <span>## SERIES_LIST GATHERS THE INFORMATION FOR EVERY YEAR AND EVERY SERIE -------------------</span>
    series_list[[serie_name]] &lt;- episodes_list_peryear
  } 
}</code></pre>
<p>Let’s have a look at the information gathered in <code>series_list</code>. Here are some of the names I collected:</p>
<pre><code>## - Black Mirror, 2011
##  Episode: The National Anthem 
##  Director: Otto Bathurst</code></pre>
<pre><code>## - Black Mirror, 2017
##  Episode: Black Museum 
##  Director: Colm McCarthy</code></pre>
<pre><code>## - Game of Thrones, 2011
##  Episode: Winter Is Coming 
##  Music team: Ramin Djawadi, Evyen Klean, David Klotz, Robin Whittaker, Michael K. Bauer, Brandon Campbell, Stephen Coleman, Janet Lopez, Julie Pearce, Joe Rubel, Bobby Tahouri</code></pre>
<pre><code>## - Game of Thrones, 2017
##  Episode: Dragonstone 
##  Music team: Ramin Djawadi, Omer Benyamin, Evyen Klean, David Klotz, William Marriott, Douglas Parker, Stephen Coleman</code></pre>
<p>What we can see is that for the same series the crew changes depending on the episode we consider.</p>
</div>
<div>
<h3>Gender Determination</h3>
<p>Now that I had all the names gathered in the <code>series_list</code>, I needed to determine the genders. I used the same package as in my previous post on the film industry: <strong>GenderizeR</strong>, which “uses genderize.io API to predict gender from first names”. More details on this package and the reasons why I decided to use it are available in my <a rel="nofollow" href="https://www.mango-solutions.com/blog/gender-diversity-in-the-film-industry" target="_blank">previous post.</a></p>
<p>With this R package, I was able to determine for each episode the number of males and females in each category of jobs:</p>
<ul>
<li>the number of male directors,</li>
<li>the number of female directors,</li>
<li>the number of male producers,</li>
<li>the number of female producers,</li>
<li>the number of males in costume team,</li>
<li>the number of females in costume team.</li>
</ul>
<p>Here is the code I wrote:</p>
<pre><code><span>### Genderize our lists of names</span>

<span># for each serie</span>
<span>for</span> (s <span>in</span> seq_along(series_list) ){  
  print(names(series_list[s])) <span># print serie name</span>
  
  <span># for each year</span>
  <span>for</span> (y <span>in</span> seq_along(series_list[[s]])){ 
    print(names(series_list[[s]][y])) <span># print serie year</span>
    
    <span># for each episode</span>
    <span>for</span> (i <span>in</span> seq_along(series_list[[s]][[y]])){ 
      print(names(series_list[[s]][[y]][i])) <span># print serie episode</span>
      
      <span># Genderize directors -----------------------------------------------------</span>
      directors &lt;- series_list[[s]][[y]][[i]]$directors
      
      <span>if</span> (directors == <span>&quot;&quot;</span>){
        directors_gender &lt;- list()
        directors_gender$male &lt;- <span>0</span>
        directors_gender$female &lt;- <span>0</span>
        series_list[[s]][[y]][[i]]$directors_gender &lt;- directors_gender
      }
      
      <span>else</span>{
        <span># Split the firstnames and the lastnames</span>
        <span># Keep the firstnames</span>
        directors &lt;- strsplit(directors, <span>&quot; &quot;</span>)
        l &lt;- c()
        <span>for</span> (j <span>in</span> seq_along(directors)){
          l &lt;- c(l, directors[[j]][<span>1</span>])
        }
        
        directors &lt;- l
        serie_directors_male &lt;- <span>0</span>
        serie_directors_female &lt;- <span>0</span>
        
        <span># Genderize every firstname and count the number of males and females </span>
        <span>for</span> (p <span>in</span> seq_along(directors)){
          directors_gender &lt;- genderizeAPI(x = directors[p], apikey = <span>&quot;233b284134ae754d9fc56717fec4164e&quot;</span>)
          gender &lt;- directors_gender$response$gender
          <span>if</span> (length(gender)><span>0</span> &amp;&amp; gender == <span>&quot;male&quot;</span>){
            serie_directors_male &lt;- serie_directors_male + <span>1</span>
          }
          <span>if</span> (length(gender)><span>0</span> &amp;&amp; gender == <span>&quot;female&quot;</span>){
            serie_directors_female &lt;- serie_directors_female + <span>1</span>
          }
        }
        
        <span># Put the number of males and females in series_list</span>
        directors_gender &lt;- list()
        directors_gender$male &lt;- serie_directors_male
        directors_gender$female &lt;- serie_directors_female
        series_list[[s]][[y]][[i]]$directors_gender &lt;- directors_gender
      }  
      
      <span># Same code for the 7 other categories -----------------------------------</span>
      
      } 
    }
  }
}</code></pre>
<p>Here are some examples of numbers of male and female I collected:</p>
<pre><code>## Black Mirror, 2011
##  Episode: The National Anthem 
##  Number of male directors: 1 
##  Number of female directors: 0 
## </code></pre>
<pre><code>## Black Mirror, 2017
##  Episode: Black Museum 
##  Number of male directors: 1 
##  Number of female directors: 0 
## </code></pre>
<pre><code>## Game of Thrones, 2011
##  Episode: Winter Is Coming 
##  Number of male in music team: 8 
##  Number of female in music team: 3 
## </code></pre>
<pre><code>## Game of Thrones, 2017
##  Episode: Dragonstone 
##  Number of male in music team: 7 
##  Number of female in music team: 0 
## </code></pre>
</div>
<div>
<h3>Percentages Calculation</h3>
<p>With these numbers gathered in my list, I then calculated the percentages of women in each job category, for each year between 2007 and 2018. I gathered these figures in a data frame called <code>percentages</code>:</p>
<pre><code>##    year directors  writers producers     sound    music      art   makeup
## 1  2018  22.69693 25.06514  27.87217 12.247212 23.25581 36.93275 73.10795
## 2  2017  20.51948 28.20016  27.28932 10.864631 25.46912 29.90641 71.41831
## 3  2016  17.13456 24.51189  27.93240 11.553444 25.03117 30.98003 71.74965
## 4  2015  16.14764 19.42845  26.43828 11.214310 22.16505 29.83354 69.50787
## 5  2014  18.38624 20.88644  27.59163 10.406150 22.21016 30.11341 69.97544
## 6  2013  14.94413 19.60432  28.15726 10.504896 23.29693 29.01968 69.01683
## 7  2012  15.60694 19.82235  29.66566 10.685681 21.45378 26.74160 67.47677
## 8  2011  13.95349 17.60722  26.73747 11.296882 17.11185 25.61805 64.81795
## 9  2010  15.95745 17.05882  27.38841 11.264644 16.51376 24.14815 65.33004
## 10 2009  16.49123 18.90496  28.79557  8.498350 21.72285 26.11128 68.15961
## 11 2008  17.87440 16.62088  29.05844  7.594264 18.74405 23.46251 68.39827
## 12 2007  21.15385 21.78771  30.12798  9.090909 19.23077 21.66124 63.03502
##     costume
## 1  77.24853
## 2  81.34648
## 3  79.35358
## 4  76.48649
## 5  76.62972
## 6  74.74791
## 7  77.35247
## 8  77.46315
## 9  77.67380
## 10 79.56332
## 11 80.53191
## 12 79.24720</code></pre>
</div>
<div>
<h3>Gender Diversity in 2017: TV Series Industry VS Film Industry</h3>
<p>Based on this data frame, I created some bar plots to visualise the gender diversity of each job category for each year. Here is the code I wrote to create the bar plot for 2017, which compares the TV series industry to the film industry.</p>
<pre><code><span>### Barplot 2017</span>

<span># Data manipulation -------------------------------------------------------------</span>

<span># Import our movies dataset</span>
percentages_movies &lt;- read.csv(<span>&quot;percentages_movies.csv&quot;</span>) 
percentages_movies &lt;- percentages_movies[ , -<span>1</span>]

<span># Change column names for movie and serie dataframes</span>
colnames(percentages_movies) &lt;- c(<span>&quot;year&quot;</span>, <span>&quot;directors&quot;</span>, <span>&quot;writers&quot;</span>, <span>&quot;producers&quot;</span>, <span>&quot;sound&quot;</span>, <span>&quot;music&quot;</span>, <span>&quot;art&quot;</span>, <span>&quot;makeup&quot;</span>, <span>&quot;costume&quot;</span>)
colnames(percentages) &lt;- c(<span>&quot;year&quot;</span>, <span>&quot;directors&quot;</span>, <span>&quot;writers&quot;</span>, <span>&quot;producers&quot;</span>, <span>&quot;sound&quot;</span>, <span>&quot;music&quot;</span>, <span>&quot;art&quot;</span>, <span>&quot;makeup&quot;</span>, <span>&quot;costume&quot;</span>)

<span># From wide to long dataframes</span>
percentages_movies_long &lt;- percentages_movies %>%
  gather(key = category, value = percentage, -year)
percentages_long &lt;- percentages %>%
  gather(key = category, value = percentage, -year)

<span># Add a column to these dataframes: movie or film ?</span>
percentages_movies_long$industry &lt;- rep(<span>&quot;Film industry&quot;</span>, <span>88</span>)
percentages_long$industry &lt;- rep(<span>&quot;Series industry&quot;</span>, <span>96</span>)

<span># Combine these 2 long dataframes</span>
percentages_movies_series &lt;- bind_rows(percentages_long, percentages_movies_long)

<span># Filter with year=2017</span>
percentages_movies_series_2017 &lt;- percentages_movies_series %>%
  filter(year == <span>2017</span>)


<span># Data visualisation -------------------------------------------------------------</span>

percentages_movies_series_2017$percentage &lt;- as.numeric(format(percentages_movies_series_2017$percentage, 
                                                        digits = <span>2</span>))

bar_2017 &lt;- ggplot(percentages_movies_series_2017, aes(x = category,
                                                       y = percentage,
                                                       group = category,
                                                       fill = category)) +
  geom_bar(stat = <span>&quot;identity&quot;</span>) +
  facet_wrap(~industry) +
  coord_flip() + <span># Horizontal bar plot</span>
  geom_text(aes(label = percentage), hjust=-<span>0.1</span>, size=<span>3</span>) +
  theme(axis.text.x=element_blank(),
        axis.ticks.x=element_blank(),
        axis.text.y=element_blank(),
        axis.ticks.y=element_blank(),
        axis.title.y=element_blank(),
        plot.title = element_text(hjust = <span>0.5</span>), <span># center the title</span>
        legend.title=element_blank()) +  
  labs(title = paste(<span>&quot;Percentages of women in 2017&quot;</span>),
       x = <span>&quot;&quot;</span>,
       y = <span>&quot;Percentages&quot;</span>) +
  guides(fill = guide_legend(reverse=<span>TRUE</span>)) + <span># reverse the order of the legend</span>
  scale_fill_manual(values = brewer.pal(<span>8</span>, <span>&quot;Spectral&quot;</span>)) <span># palette used to fill the bars and legend boxs</span></code></pre>
<p>I have built a simple shiny app which gives access to the bar plots for each year between 2007 and 2017.</p>
<p><iframe width="450" allowfullscreen="allowfullscreen" src="https://carolinebarret.shinyapps.io/shiny_app_barplots_series_vs_films/"> </iframe></p>
<p>Let’s analyse the graph of the year 2017. If we only focus on the TV series figures, we see that sound teams show the lowest female occupation, with less than 11%. It is followed by the <strong>role of director with 20.5%.</strong> Then, we can see that <strong>between 25% and 30% of the roles of writers, producers, music teams and art teams are taken by women</strong>. Thus, women are still under-represented in the TV series industry. However, even if series figures show little gender diversity in the above job categories, they are better than the film industry ones, especially for the key roles of <strong>directors, writors and producers</strong>, which are respectively <strong>5.7, 3 and 1.2 times higher for the series industry than for the film industry.</strong> The last thing to notice is that as in the film industry, the series industry graph shows a representativeness gap between the above roles and the jobs of <strong>make-up artists and costume designers, among which more than 70% of the roles are taken by women.</strong></p>
<div>
<h3>Evolution of the Gender Diversity: TV Series Industry VS Film Industry</h3>
<p>Let’s have a look at the evolution of the gender diversity in these two industries in the last decade.</p>
<pre><code><span>### Evolution plot</span>

<span># year as date</span>
percentages_movies_series_ymd &lt;- percentages_movies_series %>%
  subset(year != <span>2018</span>)
percentages_movies_series_ymd$year &lt;- ymd(percentages_movies_series_ymd$year, truncated = <span>2L</span>) 

<span># Data visualisation</span>
evolution &lt;- ggplot(percentages_movies_series_ymd, aes(x = year,
                                                       y = percentage,
                                                       group = category,
                                                       colour = category)) +
  geom_line(size = <span>2</span>) +
  facet_wrap(~industry) +
  theme(panel.grid.minor.x = element_blank(),
        plot.title = element_text(hjust = <span>0.5</span>)) + <span># center the title</span>
  scale_x_date(date_breaks = <span>&quot;2 year&quot;</span>, date_labels = <span>&quot;%Y&quot;</span>) +
  scale_color_manual(values = brewer.pal(<span>8</span>, <span>&quot;Set1&quot;</span>)) +
  labs(title = <span>&quot;Percentages of women from 2007 to 2017\n Film industry VS serie industry&quot;</span>,
       x = <span>&quot;&quot;</span>,
       y = <span>&quot;Percentages&quot;</span>)</code></pre>
<p><img sizes="(max-width: 1344px) 100vw, 1344px" src="https://i0.wp.com/www.mango-solutions.com/wp-content/uploads/sites/6/2018/08/evolution_show-1.png?w=450&ssl=1" alt="" class="wp-image-6109" data-recalc-dims="1"></p>
<p>The first thing I noticed is that for both the film and series industries, the representation gap between the roles of make-up artists and costume designers and the other ones had not decreased since 2007.</p>
<p>The fact that the roles of directors, writers and producers are more open to women in the TV series industry than in the film one is easy to visualise with this graph, and we can see that it has been the case at least since 2007 (and probably before). Besides, since 2007 the series industry has been more diversified in terms of gender for all the categories I studied, except for the sound roles.</p>
<p>I also noticed that <strong>since 2010/2011, in the TV series industry, almost all the categories tend to be more diversified in terms of gender</strong>. The only exceptions are the roles of producers (percentages are generally decreasing slightly since 2007), sound teams (no improvement has been achieved since 2010) and costume teams (the trend has been positive only since 2013). Apart from that, <strong>there is a positive trend for the TV series industry, which is not the case for the film industry</strong>.</p>
<p>This trend is significant for some roles: writers, music teams, art teams and make-up teams percentages in the series industry have increased by 5 to 10% in the last decade<strong>.</strong> But if we look at the role of <strong>directors</strong>, the percentage of women has also increased by 5% since 2011, but the percentage reached in 2017 is essentially the same as the one reached in 2007, just as for the film industry. Let’s hope that the trend seen since 2011 for directors will continue.</p>
</div>
<div>
<h3>Conclusion</h3>
<p>This study has definitely shown that <strong>the TV series industry is more diversified in terms of gender than the film industry, especially for the key roles of directors and writers</strong>.</p>
<p>However even if the series percentages are better than the film ones, <strong>women are still under-represented in the TV series industry</strong> as the same regrettable analysis has been echoed: the only jobs which seem open to women are the stereotyped female jobs of make-up artists and costume designers. In all the other categories, the percentages of women in the series industry never reach more than 30%.</p>
<p>But contrary to the film industry, the TV series one is actually evolving in the right direction: since 2011, a positive trend has been happening for directors and writers. This evolution is encouraging for the future and suggests that powerful female characters, such as Daenerys Targaryen from Game of Thrones, are coming on TV screens.</p>
</div>
</div>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://www.mango-solutions.com/blog/gender-diversity-in-the-tv-series-industry"> RBlog – Mango Solutions</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/aI8tOn2_eSA" height="1"></a></div>