Hundreds of Guardian blind dates

[This article was first published on Maëlle, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

One of my more or less guilty pleasures is reading The Guardian blind date each week. I think I started doing this when living in Cambridge, England for five months. I would buy i every weekday and The Guardian week-end every week-end. I wasn’t even dating at the time I discovered The Guardian blind dates but I’ve always liked their format.

I get so much into each date report that seeing both participants say they want to meet again makes me ridiculously happy. I like wondering how matches were made, but today I just want to look into the contents of post-date interviews.

Scraping the data

The first step was scraping the data from The Guardian’s website. Webscraping has gotten quite boring at this point on my blog I guess, but I see no alternative.

The structure of a link to a blind date was quite unpredictable so I scraped all links from the 13 pages like this one.

<span class="n">library</span><span class="p">(</span><span class="s2">"rvest"</span><span class="p">)</span><span class="w">
</span><span class="n">library</span><span class="p">(</span><span class="s2">"tidyr"</span><span class="p">)</span><span class="w">
</span><span class="n">library</span><span class="p">(</span><span class="s2">"stringr"</span><span class="p">)</span><span class="w">
</span><span class="n">library</span><span class="p">(</span><span class="s2">"dplyr"</span><span class="p">)</span><span class="w">
</span><span class="n">library</span><span class="p">(</span><span class="s2">"purrr"</span><span class="p">)</span><span class="w">
</span><span class="n">get_link</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="k">function</span><span class="p">(</span><span class="n">link</span><span class="p">){</span><span class="w">
    </span><span class="n">link</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">gsub</span><span class="p">(</span><span class="s2">"<a href=."</span><span class="p">,</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w"> </span><span class="n">link</span><span class="p">)</span><span class="w">
    </span><span class="n">link</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">gsub</span><span class="p">(</span><span class="s2">"\".*"</span><span class="p">,</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w"> </span><span class="n">link</span><span class="p">)</span><span class="w">
    </span><span class="n">link</span><span class="w">
  </span><span class="p">}</span><span class="w">
</span><span class="n">get_page_links</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="k">function</span><span class="p">(</span><span class="n">page_number</span><span class="p">){</span><span class="w">
  </span><span class="n">url</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">paste0</span><span class="p">(</span><span class="s2">"https://www.theguardian.com/lifeandstyle/series/blind-date?page="</span><span class="p">,</span><span class="w"> </span><span class="n">page_number</span><span class="p">)</span><span class="w">
  </span><span class="n">page</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">read_html</span><span class="p">(</span><span class="n">url</span><span class="p">)</span><span class="w">
  
  </span><span class="n">links</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">html_nodes</span><span class="p">(</span><span class="n">page</span><span class="p">,</span><span class="w"> </span><span class="s2">"a"</span><span class="p">)</span><span class="w"> 
  
  </span><span class="n">text</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">html_text</span><span class="p">(</span><span class="n">links</span><span class="p">)</span><span class="w">
  </span><span class="n">links</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">links</span><span class="p">[</span><span class="n">which</span><span class="p">(</span><span class="n">stringr</span><span class="o">::</span><span class="n">str_detect</span><span class="p">(</span><span class="n">text</span><span class="p">,</span><span class="w"> </span><span class="s2">"Blind date"</span><span class="p">))]</span><span class="w">
  
  </span><span class="n">links</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">purrr</span><span class="o">::</span><span class="n">map_chr</span><span class="p">(</span><span class="n">links</span><span class="p">,</span><span class="w"> </span><span class="n">get_link</span><span class="p">)</span><span class="w">
  </span><span class="n">links</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">unique</span><span class="p">(</span><span class="n">links</span><span class="p">)</span><span class="w">
  </span><span class="nf">return</span><span class="p">(</span><span class="n">links</span><span class="p">)</span><span class="w">
</span><span class="p">}</span><span class="w">

</span><span class="n">all_links</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">purrr</span><span class="o">::</span><span class="n">map</span><span class="p">(</span><span class="m">1</span><span class="o">:</span><span class="m">13</span><span class="p">,</span><span class="w"> </span><span class="n">get_page_links</span><span class="p">)</span><span class="w">
</span><span class="n">all_links</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">unlist</span><span class="p">(</span><span class="n">all_links</span><span class="p">)</span><span class="w">

</span><span class="n">head</span><span class="p">(</span><span class="n">all_links</span><span class="p">)</span><span class="w">
</span>
## [1] "https://www.theguardian.com/lifeandstyle/2017/mar/04/blind-date-damola-karen"
## [2] "https://www.theguardian.com/lifeandstyle/2017/feb/25/blind-date-david-mary"  
## [3] "https://www.theguardian.com/lifeandstyle/2017/feb/18/blind-date-dominique-ed"
## [4] "https://www.theguardian.com/lifeandstyle/2017/feb/11/blind-date-emma-gervase"
## [5] "https://www.theguardian.com/lifeandstyle/2017/feb/04/blind-date-james-lucas" 
## [6] "https://www.theguardian.com/lifeandstyle/2017/jan/28/blind-date-jonny-kit"

Doing this I found 430 links. How exciting!

Extract content from each article

Then for each article I tried to extract answers to 8 questions. I’ve seen at least one example with not exactly these questions which was a shock although the question “Would you follow them on social media?” is great.

I first wrote down all the classical questions.

<span class="n">questions</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">tibble</span><span class="o">::</span><span class="n">tibble</span><span class="p">(</span><span class="n">number</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">1</span><span class="o">:</span><span class="m">8</span><span class="p">,</span><span class="w">
                        </span><span class="n">question</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nf">c</span><span class="p">(</span><span class="s2">"First impressions"</span><span class="p">,</span><span class="w">
                                     </span><span class="s2">"What did you talk about\\?"</span><span class="p">,</span><span class="w">
                                     </span><span class="s2">"Any awkward moments\\?"</span><span class="p">,</span><span class="w">
                                     </span><span class="s2">"Good table manners\\?"</span><span class="p">,</span><span class="w">
                                     </span><span class="s2">"Best thing about"</span><span class="p">,</span><span class="w">
                                     </span><span class="s2">"Did you go on somewhere\\?"</span><span class="p">,</span><span class="w">
                                     </span><span class="s2">"Marks out of 10\\?"</span><span class="p">,</span><span class="w">
                                     </span><span class="s2">"Would you meet again\\?"</span><span class="p">))</span><span class="w">
</span>

Then I defined the function for getting answers to one question, taking into account the fact that this question was maybe not asked.

<span class="n">for_one_question</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="k">function</span><span class="p">(</span><span class="n">question</span><span class="p">,</span><span class="w"> </span><span class="n">content</span><span class="p">,</span><span class="w"> </span><span class="n">link</span><span class="p">){</span><span class="w">
  </span><span class="n">answer</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">content</span><span class="p">[</span><span class="n">which</span><span class="p">(</span><span class="n">stringr</span><span class="o">::</span><span class="n">str_detect</span><span class="p">(</span><span class="n">content</span><span class="p">,</span><span class="w"> </span><span class="n">question</span><span class="p">))]</span><span class="w">
  </span><span class="n">answer</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">str_replace</span><span class="p">(</span><span class="n">answer</span><span class="p">,</span><span class="w"> </span><span class="s2">".*<br\\/>"</span><span class="p">,</span><span class="w"> </span><span class="s2">""</span><span class="p">)</span><span class="w">
  </span><span class="n">answer</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">str_replace</span><span class="p">(</span><span class="n">answer</span><span class="p">,</span><span class="w"> </span><span class="n">question</span><span class="p">,</span><span class="w"> </span><span class="s2">""</span><span class="p">)</span><span class="w">
  </span><span class="n">answer</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">str_replace</span><span class="p">(</span><span class="n">answer</span><span class="p">,</span><span class="w"> </span><span class="s2">"<\\/p>"</span><span class="p">,</span><span class="w"> </span><span class="s2">""</span><span class="p">)</span><span class="w">
  </span><span class="n">answer</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">str_replace</span><span class="p">(</span><span class="n">answer</span><span class="p">,</span><span class="w"> </span><span class="n">question</span><span class="p">,</span><span class="w"> </span><span class="s2">""</span><span class="p">)</span><span class="w">
  </span><span class="n">answer</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">str_replace</span><span class="p">(</span><span class="n">answer</span><span class="p">,</span><span class="w"> </span><span class="s2">"<p><strong>"</span><span class="p">,</span><span class="w"> </span><span class="s2">""</span><span class="p">)</span><span class="w">
  </span><span class="n">answer</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">str_replace</span><span class="p">(</span><span class="n">answer</span><span class="p">,</span><span class="w"> </span><span class="s2">"<\\/strong>"</span><span class="p">,</span><span class="w"> </span><span class="s2">""</span><span class="p">)</span><span class="w">
  </span><span class="n">answer</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">trimws</span><span class="p">(</span><span class="n">answer</span><span class="p">)</span><span class="w">
  </span><span class="k">if</span><span class="p">(</span><span class="nf">length</span><span class="p">(</span><span class="n">answer</span><span class="p">)</span><span class="w"> </span><span class="o">></span><span class="w"> </span><span class="m">0</span><span class="p">){</span><span class="w">
    </span><span class="n">data.frame</span><span class="p">(</span><span class="n">question</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nf">rep</span><span class="p">(</span><span class="n">question</span><span class="p">,</span><span class="w"> </span><span class="m">2</span><span class="p">),</span><span class="w">
               </span><span class="n">answer</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">answer</span><span class="p">,</span><span class="w"> </span><span class="n">which</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">1</span><span class="o">:</span><span class="m">2</span><span class="p">,</span><span class="w">
               </span><span class="n">link</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nf">rep</span><span class="p">(</span><span class="n">link</span><span class="p">,</span><span class="w"> </span><span class="m">2</span><span class="p">))</span><span class="w">
  </span><span class="p">}</span><span class="k">else</span><span class="p">{</span><span class="w">
    </span><span class="kc">NULL</span><span class="w">
  </span><span class="p">}</span><span class="w">
  
</span><span class="p">}</span><span class="w"> 
</span>

And at last I could scrape all the data, that I gitignored for not making public something I’m not sure I can.

<span class="n">results</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">map</span><span class="p">(</span><span class="n">all_links</span><span class="p">,</span><span class="w"> </span><span class="n">scrape_page</span><span class="p">)</span><span class="w"> </span><span class="o">%>%</span><span class="w"> </span><span class="n">bind_rows</span><span class="p">()</span><span class="w">

</span><span class="n">readr</span><span class="o">::</span><span class="n">write_csv</span><span class="p">(</span><span class="n">results</span><span class="p">,</span><span class="w"> </span><span class="n">path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"data/2017-03-07-blinddates_allanswers.csv"</span><span class="p">)</span><span class="w">

</span>
question answer which link
First impressions Cool, comfortable, cultured. 1 https://www.theguardian.com/lifeandstyle/2017/mar/04/blind-date-damola-karen
First impressions He was very warm, friendly and dynamic. 2 https://www.theguardian.com/lifeandstyle/2017/mar/04/blind-date-damola-karen
What did you talk about\? Our families, travelling, religion, how much we both like Jamiroquai, and what it would be like living on Mars. Or a desert island. Or a desert island on Mars. Who would win: giant spider v giant octopus? The usual. 1 https://www.theguardian.com/lifeandstyle/2017/mar/04/blind-date-damola-karen
What did you talk about\? Life’s zigzags, comedy, Mars. 2 https://www.theguardian.com/lifeandstyle/2017/mar/04/blind-date-damola-karen
Any awkward moments\? When the manager raced out of the restaurant as we were saying goodbye. We thought he was going to slap us with a crazy bill. He was just coming to say goodbye. 1 https://www.theguardian.com/lifeandstyle/2017/mar/04/blind-date-damola-karen
Any awkward moments\? We were seated at different tables at the beginning. 2 https://www.theguardian.com/lifeandstyle/2017/mar/04/blind-date-damola-karen

For a Guardian blind date fan like myself, getting all this data was really cool.

Analysing blind dates

This is a quite wrong section title since I won’t do any fancy analysis. I want to look at only part of the classical questions.

So what did they talk about?

For knowing what people talked about in all these dates, I’ll look for the most common words. Note that I’m not looking at the consistency between date participants answers (in theory you should have talked about the same things as the other person on your date, but human memory isn’t perfect), and I’ll use all answers together. I remove stopwords and words related to html formatting or links in the answers.

<span class="n">library</span><span class="p">(</span><span class="s2">"tidytext"</span><span class="p">)</span><span class="w">
</span><span class="n">library</span><span class="p">(</span><span class="s2">"rcorpora"</span><span class="p">)</span><span class="w">
</span><span class="n">what</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">filter</span><span class="p">(</span><span class="n">results</span><span class="p">,</span><span class="w"> </span><span class="n">question</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="s2">"What did you talk about\\?"</span><span class="p">)</span><span class="w">

</span><span class="n">stopwords</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">corpora</span><span class="p">(</span><span class="s2">"words/stopwords/en"</span><span class="p">)</span><span class="o">$</span><span class="n">stopWords</span><span class="w">

</span><span class="n">what_words</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">what</span><span class="w"> </span><span class="o">%>%</span><span class="w">
  </span><span class="n">unnest_tokens</span><span class="p">(</span><span class="n">word</span><span class="p">,</span><span class="w"> </span><span class="n">answer</span><span class="p">)</span><span class="w"> </span><span class="o">%>%</span><span class="w">
  </span><span class="n">count</span><span class="p">(</span><span class="n">word</span><span class="p">,</span><span class="w"> </span><span class="n">sort</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">TRUE</span><span class="p">)</span><span class="w"> </span><span class="o">%>%</span><span class="w">
</span><span class="n">filter</span><span class="p">(</span><span class="o">!</span><span class="n">word</span><span class="w"> </span><span class="o">%in%</span><span class="w"> </span><span class="n">stopwords</span><span class="p">)</span><span class="w"> </span><span class="o">%>%</span><span class="w">
  </span><span class="n">filter</span><span class="p">(</span><span class="o">!</span><span class="n">word</span><span class="w"> </span><span class="o">%in%</span><span class="w"> </span><span class="nf">c</span><span class="p">(</span><span class="s2">"href"</span><span class="p">,</span><span class="w"> </span><span class="s2">"http"</span><span class="p">,</span><span class="w">
                      </span><span class="s2">"strong"</span><span class="p">,</span><span class="w"> </span><span class="s2">"link"</span><span class="p">,</span><span class="w">
                      </span><span class="s2">"https"</span><span class="p">,</span><span class="w"> </span><span class="s2">"title"</span><span class="p">,</span><span class="w">
                      </span><span class="s2">"data"</span><span class="p">,</span><span class="w"> </span><span class="s2">"body"</span><span class="p">,</span><span class="w">
                      </span><span class="s2">"class"</span><span class="p">,</span><span class="w"> </span><span class="s2">"underline"</span><span class="p">))</span><span class="w">
</span><span class="n">knitr</span><span class="o">::</span><span class="n">kable</span><span class="p">(</span><span class="n">head</span><span class="p">(</span><span class="n">what_words</span><span class="p">,</span><span class="w"> </span><span class="n">n</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">10</span><span class="p">))</span><span class="w">
</span>
word n
work 98
music 90
food 88
travel 85
london 84
meet 82
family 74
jobs 66
friends 55
travelling 50

Remember we’re looking at 430 blind dates and in particular 828 answers. So these unsurprising common themes are not that common, but then people might have used synonyms.

What grade did they give each other?

I agree that giving a grade out of 10 to your date can be a bit cruel, especially when this grade will be published in a famous newspaper, but then people get free food and often a nice evening and know about it so I guess it’s ok? In any case, I decided to extract the grades they gave each other. For this I had to use regular expressions because some people don’t only give a number, they explain their choice.

I keep only dates with two answers to the question, and for each answer I want to have only one possible grade and it has to be between 0 and 10.

<span class="n">grades</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">filter</span><span class="p">(</span><span class="n">results</span><span class="p">,</span><span class="w"> </span><span class="n">question</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="s2">"Marks out of 10\\?"</span><span class="p">)</span><span class="w">
</span><span class="n">grades</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">mutate</span><span class="p">(</span><span class="n">grades</span><span class="p">,</span><span class="w"> </span><span class="n">answer</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">str_replace</span><span class="p">(</span><span class="n">answer</span><span class="p">,</span><span class="w"> </span><span class="s2">"\\/10"</span><span class="p">,</span><span class="w"> </span><span class="s2">""</span><span class="p">))</span><span class="w">
</span><span class="n">grades</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">mutate</span><span class="p">(</span><span class="n">grades</span><span class="p">,</span><span class="w"> </span><span class="n">answer</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">str_replace</span><span class="p">(</span><span class="n">answer</span><span class="p">,</span><span class="w"> </span><span class="s2">"out of 10"</span><span class="p">,</span><span class="w"> </span><span class="s2">""</span><span class="p">))</span><span class="w">
</span><span class="n">get_grade</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="k">function</span><span class="p">(</span><span class="n">df</span><span class="p">){</span><span class="w">
  </span><span class="n">grade</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="nf">as.numeric</span><span class="p">(</span><span class="n">unlist</span><span class="p">(</span><span class="n">str_match_all</span><span class="p">(</span><span class="n">df</span><span class="o">$</span><span class="n">answer</span><span class="p">,</span><span class="w"> </span><span class="s2">"[:digit:][\\.]?[:digit:]?"</span><span class="p">)))</span><span class="w">
  </span><span class="n">grade</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">grade</span><span class="p">[</span><span class="o">!</span><span class="nf">is.na</span><span class="p">(</span><span class="n">grade</span><span class="p">)]</span><span class="w">
  </span><span class="n">grade</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">grade</span><span class="p">[</span><span class="n">grade</span><span class="w"> </span><span class="o"><=</span><span class="w"> </span><span class="m">10</span><span class="p">]</span><span class="w">
  </span><span class="k">if</span><span class="p">(</span><span class="nf">length</span><span class="p">(</span><span class="n">grade</span><span class="p">)</span><span class="w"> </span><span class="o">!=</span><span class="w"> </span><span class="m">1</span><span class="p">){</span><span class="w">
    </span><span class="m">999</span><span class="w">
  </span><span class="p">}</span><span class="k">else</span><span class="p">{</span><span class="w">
    </span><span class="n">grade</span><span class="w">
  </span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="n">grades</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">by_row</span><span class="p">(</span><span class="n">grades</span><span class="p">,</span><span class="w"> </span><span class="n">get_grade</span><span class="p">,</span><span class="w">
                 </span><span class="n">.to</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"grade"</span><span class="p">,</span><span class="w"> </span><span class="n">.collate</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"cols"</span><span class="p">)</span><span class="w">

</span><span class="n">grades</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">filter</span><span class="p">(</span><span class="n">grades</span><span class="p">,</span><span class="w"> </span><span class="n">grade</span><span class="w"> </span><span class="o">!=</span><span class="w"> </span><span class="m">999</span><span class="p">)</span><span class="w">
</span><span class="n">grades</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">group_by</span><span class="p">(</span><span class="n">grades</span><span class="p">,</span><span class="w"> </span><span class="n">link</span><span class="p">)</span><span class="w">
</span><span class="n">grades</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">filter</span><span class="p">(</span><span class="n">grades</span><span class="p">,</span><span class="w"> </span><span class="n">n</span><span class="p">()</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="m">2</span><span class="p">)</span><span class="w">
</span><span class="n">grades</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">ungroup</span><span class="p">(</span><span class="n">grades</span><span class="p">)</span><span class="w">
</span><span class="n">select</span><span class="p">(</span><span class="n">grades</span><span class="p">,</span><span class="w"> </span><span class="n">answer</span><span class="p">,</span><span class="w"> </span><span class="n">grade</span><span class="p">)</span><span class="w"> </span><span class="o">%>%</span><span class="w"> </span><span class="n">head</span><span class="p">()</span><span class="w"> </span><span class="o">%>%</span><span class="w"> </span><span class="n">knitr</span><span class="o">::</span><span class="n">kable</span><span class="p">()</span><span class="w">
</span>
answer grade
8. 8
7. 7
A strong 7 for a great evening of conversation and laughs. 7
8. 8
7. 7
10. 10

Now I can see which grades were given and most importantly how different both grades are.

I have 522 grades which means grades for 261 dates out of 430 dates which is a bit disappointing but hopefully still a representative sample. Also I’m not sure the problem is my code, sometimes people just don’t want to give a grade so they give several or write some sort of explanation with words.

<span class="n">library</span><span class="p">(</span><span class="s2">"ggplot2"</span><span class="p">)</span><span class="w">
</span><span class="n">library</span><span class="p">(</span><span class="s2">"hrbrthemes"</span><span class="p">)</span><span class="w">
</span><span class="n">ggplot</span><span class="p">(</span><span class="n">grades</span><span class="p">)</span><span class="w"> </span><span class="o">+</span><span class="w">
  </span><span class="n">geom_histogram</span><span class="p">(</span><span class="n">aes</span><span class="p">(</span><span class="n">grade</span><span class="p">))</span><span class="w"> </span><span class="o">+</span><span class="w">
  </span><span class="n">theme_ipsum_rc</span><span class="p">()</span><span class="w"> </span><span class="o">+</span><span class="w">
  </span><span class="n">labs</span><span class="p">(</span><span class="n">title</span><span class="o">=</span><span class="s2">"Grades given by Guardian blind dates participants"</span><span class="p">,</span><span class="w">
       </span><span class="n">subtitle</span><span class="o">=</span><span class="s2">"See how I use Bob Rudis' nice theme"</span><span class="p">,</span><span class="w">
       </span><span class="n">caption</span><span class="o">=</span><span class="s2">"Thank God for webscraping and regex"</span><span class="p">)</span><span class="w">
</span>

plot of chunk unnamed-chunk-7

Ok now we all want to know what date was catastrophic enough for someone to get a small grade.

<span class="n">filter</span><span class="p">(</span><span class="n">grades</span><span class="p">,</span><span class="w"> </span><span class="n">grade</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="nf">min</span><span class="p">(</span><span class="n">grade</span><span class="p">))</span><span class="w"> </span><span class="o">%>%</span><span class="w"> </span><span class="n">.</span><span class="o">$</span><span class="n">link</span><span class="w">
</span>
## [1] "https://www.theguardian.com/lifeandstyle/2012/jun/29/blind-date"

So now please all stop being sad, the actual answer was “Would it be cheeky to say the same as her and add 1?”! Which shows the limits of my code and how nice people seem to be to each other in this small sample (although maybe they’re just nice because they want the other one to be nice as well)? And to answer the participant’s question, I’d say it’s not cheeky but not analysis-friendly.

Now, did people give each other close grades?

<span class="n">grades</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">group_by</span><span class="p">(</span><span class="n">grades</span><span class="p">,</span><span class="w"> </span><span class="n">link</span><span class="p">)</span><span class="w">
</span><span class="n">grades</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">summarize</span><span class="p">(</span><span class="n">grades</span><span class="p">,</span><span class="w"> </span><span class="n">diff</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nf">abs</span><span class="p">(</span><span class="n">grade</span><span class="p">[</span><span class="m">1</span><span class="p">]</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="n">grade</span><span class="p">[</span><span class="m">2</span><span class="p">]))</span><span class="w">
</span><span class="n">ggplot</span><span class="p">(</span><span class="n">grades</span><span class="p">)</span><span class="w"> </span><span class="o">+</span><span class="w">
  </span><span class="n">geom_histogram</span><span class="p">(</span><span class="n">aes</span><span class="p">(</span><span class="n">diff</span><span class="p">))</span><span class="w"> </span><span class="o">+</span><span class="w">
  </span><span class="n">theme_ipsum_rc</span><span class="p">()</span><span class="o">+</span><span class="w">
  </span><span class="n">labs</span><span class="p">(</span><span class="n">title</span><span class="o">=</span><span class="s2">"Difference between grades"</span><span class="p">)</span><span class="w">
</span>

plot of chunk unnamed-chunk-9

To me it seems grades are pretty close, but more than an agreement it might indicate most people choose some sort of common grade no matter the date because they’re not keen on giving grades?

Did they want to meet again?

For finding out whether people would like to meet again, I decided to use sentiment analysis because I had no other better idea and I think it makes this post quite well-rounded with term frequency, number extraction and sentiment analysis. So please give me a good grade!

I used code from one tidytext vignette.

<span class="n">meet</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">filter</span><span class="p">(</span><span class="n">results</span><span class="p">,</span><span class="w"> </span><span class="n">question</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="s2">"Would you meet again\\?"</span><span class="p">)</span><span class="w">
</span><span class="n">bing</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">get_sentiments</span><span class="p">(</span><span class="s2">"bing"</span><span class="p">)</span><span class="w">

</span><span class="n">meetsentiment</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">meet</span><span class="w">  </span><span class="o">%>%</span><span class="w">
  </span><span class="n">mutate</span><span class="p">(</span><span class="n">savedanswer</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">answer</span><span class="p">)</span><span class="w"> </span><span class="o">%>%</span><span class="w">
  </span><span class="n">unnest_tokens</span><span class="p">(</span><span class="n">word</span><span class="p">,</span><span class="w"> </span><span class="n">answer</span><span class="p">)</span><span class="o">%>%</span><span class="w">
  </span><span class="n">inner_join</span><span class="p">(</span><span class="n">bing</span><span class="p">)</span><span class="w"> </span><span class="o">%>%</span><span class="w">
  </span><span class="n">count</span><span class="p">(</span><span class="n">link</span><span class="p">,</span><span class="w"> </span><span class="n">which</span><span class="p">,</span><span class="w"> </span><span class="n">savedanswer</span><span class="p">,</span><span class="w"> </span><span class="n">sentiment</span><span class="p">)</span><span class="w"> </span><span class="o">%>%</span><span class="w">
  </span><span class="n">spread</span><span class="p">(</span><span class="n">sentiment</span><span class="p">,</span><span class="w"> </span><span class="n">n</span><span class="p">,</span><span class="w"> </span><span class="n">fill</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">0</span><span class="p">)</span><span class="w"> </span><span class="o">%>%</span><span class="w">
  </span><span class="n">mutate</span><span class="p">(</span><span class="n">sentiment</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">positive</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="n">negative</span><span class="p">)</span><span class="w"> </span><span class="o">%>%</span><span class="w">
  </span><span class="n">filter</span><span class="p">(</span><span class="o">!</span><span class="nf">is.na</span><span class="p">(</span><span class="n">sentiment</span><span class="p">))</span><span class="w">
</span>

So how often did one of them want to meet the other again?

<span class="n">ggplot</span><span class="p">(</span><span class="n">meetsentiment</span><span class="p">)</span><span class="w"> </span><span class="o">+</span><span class="w">
  </span><span class="n">geom_bar</span><span class="p">(</span><span class="n">aes</span><span class="p">(</span><span class="n">sentiment</span><span class="p">))</span><span class="w"> </span><span class="o">+</span><span class="w">
  </span><span class="n">theme_ipsum_rc</span><span class="p">()</span><span class="w">
</span>

plot of chunk unnamed-chunk-11

To get an idea of how good my sentiment analysis is working – probably not well, let’s look at the extremes.

<span class="n">filter</span><span class="p">(</span><span class="n">meetsentiment</span><span class="p">,</span><span class="w"> </span><span class="n">sentiment</span><span class="w"> </span><span class="o"><</span><span class="m">0</span><span class="p">)</span><span class="w"> </span><span class="o">%>%</span><span class="w">
  </span><span class="n">head</span><span class="p">()</span><span class="w"> </span><span class="o">%>%</span><span class="w"> </span><span class="n">knitr</span><span class="o">::</span><span class="n">kable</span><span class="p">()</span><span class="w">
</span>
link which savedanswer negative positive sentiment
https://www.theguardian.com/lifeandstyle/2009/apr/11/blind-date-cash-coryton 2 I don’t think we’ll arrange anything, but Brighton is a small place and we’d stop to chat if we bumped into each other. 1 0 -1
https://www.theguardian.com/lifeandstyle/2009/aug/01/blind-date 2 I’m sure we will – it would be a shame not to. 1 0 -1
https://www.theguardian.com/lifeandstyle/2009/feb/28/blind-date-relationships 1 We swapped numbers, but I don’t think there will be any romance, sadly. 1 0 -1
https://www.theguardian.com/lifeandstyle/2009/feb/28/blind-date-relationships 2 She didn’t seem that interested, so I doubt it. 1 0 -1
https://www.theguardian.com/lifeandstyle/2009/may/02/ian-winterton-jane-thomas 1 I would but she lives in the Wirral, so it’s unlikely to happen that often. 1 0 -1
https://www.theguardian.com/lifeandstyle/2009/oct/24/blind-date 2 We did the number swap thing, so it would be a shame not to. 1 0 -1

So actually it’s not too bad on this small subset although “a shame not to” shouldn’t be sorted in this category.

<span class="n">filter</span><span class="p">(</span><span class="n">meetsentiment</span><span class="p">,</span><span class="w"> </span><span class="n">sentiment</span><span class="w"> </span><span class="o">></span><span class="m">3</span><span class="p">)</span><span class="w"> </span><span class="o">%>%</span><span class="w">
  </span><span class="n">head</span><span class="p">()</span><span class="w"> </span><span class="o">%>%</span><span class="w"> </span><span class="n">knitr</span><span class="o">::</span><span class="n">kable</span><span class="p">()</span><span class="w">
</span>
link which savedanswer negative positive sentiment
https://www.theguardian.com/lifeandstyle/2010/aug/07/blind-date 1 It was fun and Ali was very nice, but could I ever love a woman who doesn’t like Morrissey? That was a deal breaker, I’m afraid. 1 5 4
https://www.theguardian.com/lifeandstyle/2010/aug/14/blind-date 1 Only as friends. I wasn’t physically attracted to Matt, but found him to be a warm, charming and very nice bloke. 0 4 4
https://www.theguardian.com/lifeandstyle/2010/aug/21/blind-date 2 I enjoyed the night and thought we got on really well, but I’m not sure if we’ll arrange to meet up again. We’re both going to the same music festival in September, so it would be great to run into her and catch up then. 0 4 4
https://www.theguardian.com/lifeandstyle/2010/dec/11/blind-date 1 Definitely for drinks as friends. We’ve already said we’ll meet up soon – Mal has promised to show me how to dance properly to jungle music, although I may be better than him as it stands. 0 4 4
https://www.theguardian.com/lifeandstyle/2010/nov/06/blind-date 2 No – we had very little in common. But it’s a mark of what good company she is that I still managed to have a lovely evening! 0 4 4
https://www.theguardian.com/lifeandstyle/2010/oct/30/blind-date 2 She’s great fun, so it’d be good to see her again sometime. 0 4 4

Mmmh so here it works much less well. I should maybe weight by length of the sentence because apparently “just as friends” sometimes needs many compliments to make it less hurtful. But then given the efforts I invested in automatically sorting the answers (close to zero), I can’t complain and will leave this as is.

Last words

I could have done more with this dataset! Ideas I have include also extracting age and profession of the participants, and find which industries are the most represented/compatible using my R monkeylearn package as I did in my #first7jobs analysis. I have also noticed the address of the restaurant where people had dinner is written at the end of each post, which makes me want to geocode them all with opencage. But what would motivate me even more would be to use Scott Chamberlain’s charlatan package to create false names and jobs of dates, and then rcorpora to generate their false interviews. If I did that I could read one “Guardian” blind date per day instead of one per week!

To end on a more serious note, Guardian journalists report on other important stuff such as politics and the environment, so if you can please consider becoming a Guardian Supporter. My husband and I did and we’re quite happy we did!

To leave a comment for the author, please follow the link and comment on their blog: Maëlle.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)