Objective:

This is the peer-graded assignment of Coursera Data Product course(Week 2).
The objective of this assignment is to create a web page using R Markdown that features an interactive map created with Leaflet.

Summary

The Basic Health Units (BHU) are the preferred entry point of the Unified Health System (SUS). The goal of these posts is to meet up to 80% of the population’s health problems, without the need for sending the pacients to hospitals. For more information about the data, please visit: http://repositorio.dados.gov.br/saude/unidades-saude/unidade-basica-saude/ubs.csv

Getting and cleaning the data

library(leaflet)
## Warning: package 'leaflet' was built under R version 3.4.2
# Set working directory
setwd("~/R_coursera/Data Product")
# Load dataset Basic Health Units(Clinics)
ubs <- read.csv("ubs.csv",header = T)
# Select the city of Rio de Janeiro
ubs <- ubs[ubs$dsc_cidade=="Rio de Janeiro",]
# Get latitudes and longitudes
df <- data.frame(lat = ubs$vlr_latitude,
                 lng = ubs$vlr_longitude)
# Clean the Clinic´s names to display
names <- as.character(ubs$nom_estab)
names <- gsub("SMSDC CF ","",names)
names <- gsub("SMSDC CMS ","",names)
names <- substr(names,1,nchar(names)-5)
names <- paste("Clinic:",names)

Leaflet interactive map

Interactive map with markers of the Health Clinics in the city of Rio de Janeiro.