wakibia / Web_scraping

This is a short repository showing how to perform web scraping in R using Rvest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Web_scraping

This is a short repository showing how to perform web scraping in R using Rvest

Web Scraping Kenya Meteorological Department

  • This tutorial shows how to scrape a weather website using rrvest package
  • The website can be accessed at Kenya Meteorological Department
  • The towns whose wether have been included are only 24 but it's good to show how to scrape the data

Web scraping procedure

  • You need to familiarise yourself with the HTML and CSS language which you can learn at HTML Tutorials and CSS tutorials
  • This will help you identifying the target nodes
  • Next you need to use the selectorGadget which is a google chrome extension and you can add it from Selector gadget extension
  • This is a video tutorial on how to use the selectorGadget Video tutorial
  • Finally you need to install the rvest package in R install.packages("rvest")
  • You can see some of the nodes and attributes among other things you can do to retrieve information from the site you have intended to scrape from rvest tidyverse

Variables we seek to get after performing web scraping

The variables we seek to get are:

  • Town
  • Weather Condition
  • Minimum Temperature
  • Maximum Temperature

We will finally create a data frame using these variables

Note that the site being scraped shows the most current weather conditions

About

This is a short repository showing how to perform web scraping in R using Rvest


Languages

Language:HTML 99.8%Language:R 0.2%