<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="http://www.r-bloggers.com/women-in-orchestras/"></div></div><div><a data-url="http://www.r-bloggers.com/women-in-orchestras/" data-counturl="http://www.r-bloggers.com/women-in-orchestras/" data-count="horizontal" data-text="Women in Orchestras" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://aschinchon.wordpress.com/2016/06/06/women-in-orchestras/"> Ripples</a></strong>, and kindly contributed to <a rel="nofollow" href="http://www.r-bloggers.com/">R-bloggers)</a> </div>
<blockquote><p>I believe in the truth of fairy-tales more than I believe in the truth in the newspaper (Lotte Reiniger)</p>
</blockquote>
<p>In my opinion, this graph is a visual demonstration that we live in a male very chauvinist world.</p>
<p><img alt="Orchestras2" class="wp-image-2825" src="https://aschinchon.files.wordpress.com/2016/06/orchestras2.png?w=604"></p>
<p>In this experiment I download the members of ten top orchestras of the world with the amazing <code>rvest</code> package. After cleaning texts, I obtain the gender of names with <code>genderizeR</code> package as I did <a target="_blank" href="https://aschinchon.wordpress.com/2016/02/17/the-gender-of-big-data/">here</a>. Since I only take into account names <em>genderized </em>with high probability, these numbers cannot be exact. Apart of this, the plot speaks by itself.</p>
<pre>
setwd(&quot;YOUR WORKING DIRECTORY HERE&quot;)
library(rvest)
library(dplyr)
library(genderizeR)
read_html(&quot;http://www.berliner-philharmoniker.de/en/orchestra/&quot;) %>%
  html_nodes(&quot;.name&quot;) %>%
  html_text(trim=TRUE) %>%
  iconv(&quot;UTF-8&quot;) %>%
  gsub(&quot;[\r,\n]&quot;,&quot; &quot;, .) %>%
  gsub(&quot;\\s+&quot;, &quot; &quot;, .) %>%
  paste(collapse=&quot; &quot;) %>%
  findGivenNames() -> berliner
read_html(&quot;https://www.concertgebouworkest.nl/en/musicians&quot;) %>%
  html_nodes(&quot;.u-padding--b2&quot;) %>%
  html_text(trim=TRUE) %>%
  iconv(&quot;UTF-8&quot;) %>%
  gsub(&quot;\\s+&quot;, &quot; &quot;, .) %>%
  paste(collapse=&quot; &quot;) %>%
  findGivenNames() -> rco
read_html(&quot;http://www.philharmonia.spb.ru/en/about/orchestra/zkrasof/contents/&quot;) %>%
  html_nodes(&quot;.td&quot;) %>%
  html_text(trim=TRUE) %>%
  iconv(&quot;UTF-8&quot;) %>%
  gsub(&quot;[\r,\n]&quot;,&quot; &quot;, .) %>%
  gsub(&quot;\\s+&quot;, &quot; &quot;, .) %>%
  .[23] %>%
  findGivenNames() -> spb
read_html(&quot;http://ocne.mcu.es/conoce-a-la-ocne/orquesta-nacional-de-espana/componentes/&quot;) %>%
  html_nodes(&quot;.col-main&quot;) %>%
  html_text(trim=TRUE) %>%
  iconv(&quot;UTF-8&quot;) %>%
  gsub(&quot;[\r,\n]&quot;,&quot; &quot;, .) %>%
  gsub(&quot;\\s+&quot;, &quot; &quot;, .) %>%
  gsub(&quot;([[:lower:]])([[:upper:]][[:lower:]])&quot;, &quot;\\1 \\2&quot;, .) %>%
  findGivenNames() -> one
read_html(&quot;http://www.gewandhausorchester.de/en/orchester/&quot;) %>%
  html_nodes(&quot;#content&quot;) %>%
  html_text(trim=TRUE) %>%
  iconv(&quot;UTF-8&quot;) %>%
  gsub(&quot;[\r,\n]&quot;,&quot; &quot;, .) %>%
  gsub(&quot;\\s+&quot;, &quot; &quot;, .) %>%
  findGivenNames()  -> leipzig
read_html(&quot;http://www.wienerphilharmoniker.at/orchestra/members&quot;) %>%
  html_nodes(&quot;.ModSuiteMembersC&quot;) %>%
  html_text(trim=TRUE) %>%
  iconv(&quot;UTF-8&quot;) %>%
  gsub(&quot;[\r,\n,\t,*]&quot;,&quot; &quot;, .) %>%
  gsub(&quot;\\s+&quot;, &quot; &quot;, .) %>%
  gsub(&quot;([[:lower:]])([[:upper:]][[:lower:]])&quot;, &quot;\\1 \\2&quot;, .) %>%
  paste(collapse=&quot; &quot;) %>%
  .[-18] %>%
  findGivenNames() -> wiener
read_html(&quot;http://www.laphil.com/philpedia/orchestra-roster&quot;) %>%
  html_nodes(&quot;.view-content&quot;) %>%
  html_text(trim=TRUE) %>%
  iconv(&quot;UTF-8&quot;) %>%
  gsub(&quot;\\s+&quot;, &quot; &quot;, .) %>%
  gsub(&quot;(?%
  .[1] %>%
  findGivenNames() -> laphil
read_html(&quot;http://nyphil.org/about-us/meet/musicians-of-the-orchestra&quot;) %>%
  html_nodes(&quot;.resp-tab-content-active&quot;) %>%
  html_text(trim=TRUE) %>%
  iconv(&quot;UTF-8&quot;) %>%
  gsub(&quot;[\r,\n]&quot;,&quot; &quot;, .) %>%
  gsub(&quot;\\s+&quot;, &quot; &quot;, .) %>%
  gsub(&quot;(?%
  findGivenNames() -> nyphil
urls=c(&quot;http://lso.co.uk/orchestra/players/strings.html&quot;,
       &quot;http://lso.co.uk/orchestra/players/woodwind.html&quot;,
       &quot;http://lso.co.uk/orchestra/players/brass.html&quot;,
       &quot;http://lso.co.uk/orchestra/players/percussion-harps-and-keyboards.html&quot;)
sapply(urls, function(x)
{
  read_html(x) %>%
    html_nodes(&quot;.clearfix&quot;) %>%
    html_text(trim=TRUE) %>%
    iconv(&quot;UTF-8&quot;) %>%
    gsub(&quot;[\r,\n,\t,*]&quot;,&quot; &quot;, .) %>%
    gsub(&quot;\\s+&quot;, &quot; &quot;, .)
}) %>% paste(., collapse=&quot; &quot;) %>%
  findGivenNames() -> lso
read_html(&quot;http://www.osm.ca/en/discover-osm/orchestra/musicians-osm&quot;) %>%
  html_nodes(&quot;#content-column&quot;) %>%
  html_text(trim=TRUE) %>%
  iconv(&quot;UTF-8&quot;) %>%
  gsub(&quot;[\r,\n]&quot;,&quot; &quot;, .) %>%
  gsub(&quot;\\s+&quot;, &quot; &quot;, .) %>%
  findGivenNames() -> osm
rbind(c(&quot;berliner&quot;, &quot;Berliner Philharmoniker&quot;),
c(&quot;rco&quot;, &quot;Royal Concertgebouw Amsterdam&quot;),
c(&quot;spb&quot;, &quot;St. Petersburg Philharmonic Orchestra&quot;),
c(&quot;one&quot;, &quot;Orquesta Nacional de España&quot;),
c(&quot;leipzig&quot;, &quot;Gewandhaus Orchester Leipzig&quot;),
c(&quot;wiener&quot;, &quot;Wiener Philarmoniker&quot;),
c(&quot;laphil&quot;, &quot;The Los Angeles Philarmonic&quot;),
c(&quot;nyphil&quot;, &quot;New York Philarmonic&quot;),
c(&quot;lso&quot;, &quot;London Symphony Orchestra&quot;),
c(&quot;osm&quot;, &quot;Orchestre Symphonique de Montreal&quot;)) %>% as.data.frame()-> Orchestras
colnames(Orchestras)=c(&quot;Id&quot;, &quot;Orchestra&quot;)
list.files(getwd(),pattern = &quot;.RDS&quot;) %>%
  lapply(function(x)
  readRDS(x) %>% as.data.frame(stringsAsFactors = FALSE) %>% cbind(Id=gsub(&quot;.RDS&quot;, &quot;&quot;, x))
  ) %>% do.call(&quot;rbind&quot;, .) -> all
all %>% mutate(probability=as.numeric(probability)) %>%
  filter(probability > 0.9 &amp; count > 15) %>%
  filter(!name %in% c(&quot;viola&quot;, &quot;tuba&quot;, &quot;harp&quot;)) %>%
  group_by(Id, gender) %>%
  summarize(Total=n())->all
all %>% filter(gender==&quot;female&quot;) %>% mutate(females=Total) %>% select(Id, females) -> females
all %>% group_by(Id) %>% summarise(Total=sum(Total)) -> total
inner_join(total, females, by = &quot;Id&quot;) %>% mutate(po_females=females/Total) %>%
  inner_join(Orchestras, by=&quot;Id&quot;)-> df
library(ggplot2)
library(scales)
opts=theme(legend.position=&quot;none&quot;,
           plot.background = element_rect(fill=&quot;gray85&quot;),
           panel.background = element_rect(fill=&quot;gray85&quot;),
           panel.grid.major.y=element_blank(),
           panel.grid.major.x=element_line(colour=&quot;white&quot;, size=2),
           panel.grid.minor=element_blank(),
           axis.title = element_blank(),
           axis.line.y = element_line(size = 2, color=&quot;black&quot;),
           axis.text = element_text(colour=&quot;black&quot;, size=18),
           axis.ticks=element_blank(),
           plot.title = element_text(size = 35, face=&quot;bold&quot;, margin=margin(10,0,10,0), hjust=0))
ggplot(df, aes(reorder(Orchestra, po_females), po_females)) +
  geom_bar(stat=&quot;identity&quot;, fill=&quot;darkviolet&quot;, width=.5)+
  scale_y_continuous(labels = percent, expand = c(0, 0), limits=c(0,.52))+
  geom_text(aes(label=sprintf(&quot;%1.0f%%&quot;, 100*po_females)), hjust=-0.05, size=6)+
  ggtitle(expression(atop(bold(&quot;Women in Orchestras&quot;), atop(&quot;% of women among members&quot;, &quot;&quot;)))) +
  coord_flip()+opts
</pre>
<p> <a target="_blank" rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aschinchon.wordpress.com/2799/"><img alt="" src="http://feeds.wordpress.com/1.0/comments/aschinchon.wordpress.com/2799/" border="0"></a> <img height="1" alt="" width="1" src="https://pixel.wp.com/b.gif?host=aschinchon.wordpress.com&blog=62377824&%23038;post=2799&%23038;subd=aschinchon&%23038;ref=&%23038;feed=1" border="0"></p>
<p><div><div><div><div data-width="55" data-show-faces="false" data-send="true" data-layout="box_count" data-height="62" data-href="http://www.r-bloggers.com/women-in-orchestras/"></div></div><div><a data-url="http://www.r-bloggers.com/women-in-orchestras/" data-counturl="http://www.r-bloggers.com/women-in-orchestras/" data-count="vertical" data-text="Women in Orchestras" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://aschinchon.wordpress.com/2016/06/06/women-in-orchestras/"> Ripples</a></strong>.</div>
<hr>
<a rel="nofollow" href="http://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="http://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="http://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="http://www.r-bloggers.com/?s=data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="http://www.r-bloggers.com/?s=Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="http://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="http://www.r-bloggers.com/?s=map">maps</a>, <a title="Animation in R" rel="nofollow" href="http://www.r-bloggers.com/?s=animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="http://www.r-bloggers.com/?s=RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="http://www.r-bloggers.com/?s=sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="http://www.r-bloggers.com/?s=LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="http://www.r-bloggers.com/?s=SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="http://www.r-bloggers.com/?s=eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="http://www.r-bloggers.com/?s=git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="http://www.r-bloggers.com/?s=hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="http://www.r-bloggers.com/?s=Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="http://www.r-bloggers.com/?s=PCA">PCA</a>, <a title="Time series" rel="nofollow" href="http://www.r-bloggers.com/?s=time+series">time series</a>, <a title="finance trading" rel="nofollow" href="http://www.r-bloggers.com/?s=trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/Sq13-hMpjpc"></a></div>