<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/web-scraping-exercises/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://r-exercises.com/2016/12/20/web-scraping-exercises/"> R-exercises</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p><a target="_blank" rel="nofollow" href="http://r-exercises.com/wp-content/uploads/2016/12/barbed-wire-508047_960_720.jpg?x61433"><img sizes="(max-width: 150px) 100vw, 150px" alt="" class="wp-image-3518" src="https://i1.wp.com/r-exercises.com/wp-content/uploads/2016/12/barbed-wire-508047_960_720-150x150.jpg?resize=150%2C150" data-recalc-dims="1"></a></p>
<p>[For this exercise, before proceeding, first read the rvest package help and the selectorgadget help.]</p>
<p>Answers to the exercises are available <a target="_blank" rel="nofollow" href="http://r-exercises.com/2016/12/20/web-scraping-solutions/">here</a>.</p>
<p><strong>Exercise 1</strong></p>
<p>Consider the url ‘http://statbel.fgov.be/en/statistics/figures/economy/indicators/prix_prod_con/’<br>
Extract all the information load on table ‘Third Quarter 2016’.</p>
<p><strong>Exercise 2</strong></p>
<p>Consider the url ‘http://www2.sas.com/proceedings/sugi30/toc.html’<br>
Extract all the papers names, from 001-30 to 268-30</p>
<p><strong>Exercise 3</strong></p>
<p>Consider the url ‘http://www.gibbon.se/Retailer/Map.aspx?SectionId=832’<br>
Extract all the options (countries) availables on select button.</p>
<p><strong>Exercise 4</strong></p>
<p>Consider the url ‘http://r-exercises.com/start-here-to-learn-r/’<br>
Extract all the topics available on the url.</p>
<p><strong>Exercise 5</strong></p>
<p>Consider the url ‘http://www.immobiliare.it/Roma/agenzie_immobiliari_provincia-Roma.html’<br>
Extract all inmobiliaries names published on first page.</p>
<p><strong>Exercise 6</strong></p>
<p>Consider the url ‘http://www.gibbon.se/Retailer/Map.aspx?SectionId=832’.<br>
Extract the links to the detailed information of each row on the table.<br>
For example, for the first adress, Karlbergsvägen 32, 113 27 stockholm, the details are<br>
A.E.N HUND I STAN AB<br>
ADRESS OCH ÖPPETTIDER<br>
Karlbergsvägen 32<br>
113 27 STOCKHOLM<br>
Öppettider:<br>
Telefon: 08-313058<br>
Mail-adress: info@hundistan.eu<br>
Hemsida:<br>
The link to that details (clicking on Karlbergsvägen 32, 113 27 stockholm) is http://www.gibbon.se/Retailer/Retailer.aspx?ItemId=45128.<br>
You have to extract all the links available, one per row.</p>
<p><strong>Exercise 7</strong></p>
<p>Consider the url ‘https://www.bkk-klinikfinder.de/suche/suchergebnis.php?next=1’<br>
Extract the links to the detailed information of each hospital. For example, for the hospital<br>
Krankenhaus Dresden-Friedrichstadt Städtisches Klinikum, the details are available on the link:<br>
https://www.bkk-klinikfinder.de/krankenhaus/index.php?id=26140094900</p>
<p><strong>Exercise 8</strong></p>
<p>Consider the url scraped in Exercise 7.<br>
Extract the links to ‘Details’ for each hospital display on the first 4 pages.</p>
<p><strong>Exercise 9</strong></p>
<p>Consider the url=’http://www.dictionary.com/browse/’ and the words ‘handy’,’whisper’,’lovely’,’scrape’.<br>
Build a data frame, where the first variables is “Word” and the second variables is “definitions”. Scrape the definitions from the url.</p>
<p><strong>Exercise 10</strong><br>
Consider the url ‘http://www.gibbon.se/Retailer/Map.aspx?SectionId=832’.<br>
Build a data frame with all the information available for each row.<br>
For example, for the first adress, Karlbergsvägen 32, 113 27 stockholm, the details are<br>
A.E.N HUND I STAN AB</p>
<p> ADRESS OCH ÖPPETTIDER<br>
Karlbergsvägen 32<br>
113 27 STOCKHOLM<br>
Öppettider:<br>
Telefon: 08-313058<br>
Mail-adress: info@hundistan.eu<br>
Hemsida:<br>
For the second row, Inedalsgatan 5, 112 33 stockholm, the details are<br>
ARKENZOO KUNGSHOLMEN A<br>
ADRESS OCH ÖPPETTIDER<br>
Kungs Zoo AB<br>
Inedalsgatan 5<br>
112 33 STOCKHOLM<br>
Öppettider:<br>
Telefon: 08-7248110<br>
Mail-adress: kungsholmen@arkenzoo.se<br>
Hemsida: www.arkenzoo.se</p>
<p>This details will be saved on the first row of the data.frame.<br>
Website address Name of store Phone Number Email adress City Country<br>
1 A.E.N Hund i Stan AB 08-313058 info@hundistan.eu Stocholm Sweden<br>
2 www.arkenzoo.se ArkenZoo Kungsholmen A 08-7248110 kungsholmen@arkenzoo.se Stocholm Sweden</p>
<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://r-exercises.com/2016/12/20/web-scraping-exercises/"> R-exercises</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 title="The R Project for Statistical Computing" rel="nofollow" href="https://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/search/data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="https://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/search/map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/search/animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/search/sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/search/SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/search/git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/search/hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/search/PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/search/time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/search/trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/U-sXpYkt4rM"></a></div>