Create a web page using R Markdown that features a map created with Leaflet. Host your webpage on either GitHub Pages, RPubs, or NeoCities. Your webpage must contain the date that you created the document, and it must contain a map created with Leaflet. We would love to see you show off your creativity!
This project is part of Coursera - John Hopkins University course on R Markdown and Leaflet.
In this project, we will create map containing Korean Restaurant Data in Riyadh, Saudi Arabia. The data contains coordinate, rating and price. We will use Github and Rpub to host webpage. Below are the step used to generate webpage :
Import Restaurant data set from local directory and load necessary library. Data is attached in here in github, file name : Korean_Rest_Riyadh.csv
Generate Leaflet, Tiles and Marker, we will show restaurant name, rating and price range
Generate Map
We will import data set and will save as Restaurant variable
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(leaflet)
## Warning: package 'leaflet' was built under R version 4.4.2
library(htmltools)
## Warning: package 'htmltools' was built under R version 4.4.2
restaurant <- read.csv("C:/RSTUDIO/COURSERA/R DATA SCIENCE/DATA PRODUCT/Korean_Rest_Riyadh.csv", header = TRUE)
print(restaurant)
## RestaurantName City Long Lat Country Rating Price
## 1 Korean Palace Riyadh 46.66226 24.71191 Saudi Arabia 4 Medium
## 2 Seoul Restaurant Riyadh 46.70218 24.70465 Saudi Arabia 3 Medium
## 3 Woo Samgyup RIyadh 46.70408 24.69208 Saudi Arabia 3 Cheap
## 4 Namu Riyadh 46.64249 24.72683 Saudi Arabia 4 Expensive
## 5 Meatin Gril Riyadh 46.70173 24.69621 Saudi Arabia 2 Cheap
## 6 JeJu RIyadh 46.71019 24.69108 Saudi Arabia 4 Medium
## 7 Yao Barbecue Riyadh 46.69549 24.69293 Saudi Arabia 3 Medium
Below are My best Korean Restaurant in Riyadh Saudi Arabia
restaurant_map <- restaurant |> leaflet() |> addTiles() |>
addMarkers(popup = paste ("<br>Country: ", htmlEscape(restaurant$Country),
"<br>City: ",htmlEscape(restaurant$City),
"<br>Restaurant: ",htmlEscape(restaurant$RestaurantName),
"<br>Price: ",htmlEscape(restaurant$Price),
"<br>Rating: ",htmlEscape(restaurant$Rating)))
## Assuming "Long" and "Lat" are longitude and latitude, respectively
restaurant_map