Outcomes

1. Mapped Gender Based Violence (GBV) Services in Rohingya Refugee Camps in Cox’s Bazar Using R Programming

2. Measured distances between Rohingya Refugee Camps in Cox’s Bazar Using R Programming

Setting Path

# Clean up everything
rm(list = ls())
# setting path of working directory
setwd("F:/Maps")
# Checking r-version
print(version$version.string) # Checking r-version

Required R Packages

library("tidyverse")
library("leaflet")
library("htmltools")
library("htmlwidgets")
library("leafpop")
library("purrr")
library("Hmisc")
library("reactable")
library("leaflet.extras")
library("geosphere")

Data

Data source:

  1. Updated: 12 August 2021: Location of Rohingya Refugees in Cox’s Bazar as of 30 June 2021 sourced from RRRC-UNHCR Family Counting Exercise Data

  2. Updated: 4 May 2021: 210228_ISCG_4W_Consolidated_R63_WEB. There are four sheets visible to users in this workbook: 4W, WHAT (Activities Index), WHO (Agency Index) and WHERE (Location Index), and 4W Read Me provides basic information on how to use this information management tool.

Data source url:

  1. https://data.humdata.org/dataset/d1cd6842-dfe1-44c7-a1f5-3769000073af/resource/1c66a857-d11a-4519-baca-8f1f5e2ce2a4/download/20210810_location_fce_rrrc_unhcr_population-registration_public.xlsx

  2. https://data.humdata.org/dataset/bf11f6b9-1a2c-424a-ae22-7cd9060d14d7/resource/bf360e11-1275-4206-adb4-344a6e3f0d34/download/210228_iscg_4w_consolidated_r63_web.xlsx

#rohingya_camps <- read_csv("20210810_location_fce_rrrc_unhcr_population-registration_public.csv")
rohingya_camps <- read_csv("20210318_location_fce_rrrc_unhcr_population-registration_public.csv")

outline <- rohingya_camps[chull(rohingya_camps$Longitude, rohingya_camps$Latitude), ]
rohingya_camps_all <- read_csv("210228_iscg_4w_data.csv")
rohingya_camps_gbv <- dplyr::filter(rohingya_camps_all, sector_sub_sec_assistance == "GBV" & type_of_beneficiaries == "Refugee")

Data manupulation

rohingya_camps_gbv <- rohingya_camps_gbv %>%
  dplyr::group_by(camp_village_location_name) %>%
  dplyr::summarise(
    reached_total_individuals = sum(reached_total_individuals, na.rm = FALSE),
    reached_total_female_individuals = sum(reached_total_female_individuals, na.rm = FALSE),
    reached_total_male_individuals = sum(reached_total_male_individuals, na.rm = FALSE),
    total_girls_beneficiaries_below_18 = sum(total_girls_beneficiaries_below_18, na.rm = FALSE),
    total_boys_beneficiaries_below_18 = sum(total_boys_beneficiaries_below_18, na.rm = FALSE),
    total_women_beneficiaries_18_59 = sum(total_women_beneficiaries_18_59, na.rm = FALSE),
    total_men_beneficiaries_18_59 = sum(total_men_beneficiaries_18_59, na.rm = FALSE),
    total_elderly_women_beneficiaries_above_59 = sum(total_elderly_women_beneficiaries_above_59, na.rm = FALSE),
    total_elderly_men_beneficiaries_above_59 = sum(total_elderly_men_beneficiaries_above_59, na.rm = FALSE),
    no_implementing_partner = sum(implementing_partner = n_distinct(implementing_partner, na.rm = FALSE))
  ) %>%
  ungroup()

Filtering data by gender based violence (GBV) services

rohingya_camps_gbv <- dplyr::filter(rohingya_camps_gbv, !camp_village_location_name %in% c("Transit Site"))

saving data in local directory

write.csv(rohingya_camps_gbv, "rohingya_camps_gbv.csv")

Merging two data sets

gbv_camps <- dplyr::inner_join(rohingya_camps_gbv, rohingya_camps, by = c("camp_village_location_name" = "New_Camp_Name"))
# see variables in vector form
dput(names(gbv_camps))
# keeping necessary variables
gbv_camps <- dplyr::select(
  gbv_camps, camp_village_location_name, `Settlement Type`, District, Upazila, Union, reached_total_individuals,
  reached_total_female_individuals, reached_total_male_individuals,
  total_girls_beneficiaries_below_18, total_boys_beneficiaries_below_18,
  total_women_beneficiaries_18_59, total_men_beneficiaries_18_59,
  total_elderly_women_beneficiaries_above_59, total_elderly_men_beneficiaries_above_59,
  no_implementing_partner, Total_HH, Total_Individuals, Latitude, Longitude
)

CPI in Ruhingya Camp

cpi_camps <- dplyr::filter(gbv_camps, camp_village_location_name %in% c("Camp 1W", "Camp 4", "Camp 13", "Camp 14", "Camp 15", "Camp 16") )

# Saving data in local directory
write.csv(gbv_camps, "rohingya_camps_gbv_hh.csv")
# Creating HTML data table
info_cam <- reactable::reactable(gbv_camps, 
                                 searchable = TRUE,
                                 sortable = TRUE,
                                 showSortIcon = FALSE,
                                 compact = TRUE,
                                 pagination = TRUE)

htmlwidgets::prependContent(info_cam, 
                            h3(class = "title", "Table 1: Population, Household, GBV Services in Rohingya Refugee Camps"))

Table 1: Population, Household, GBV Services in Rohingya Refugee Camps

Knitting Codes for Map

Creating a customize title

tag.map.title <- tags$style(HTML("
  .leaflet-control.map-title { 
    transform: translate(-50%,20%);
    position: fixed !important;
    left: 50%;
    text-align: center;
    padding-left: 10px; 
    padding-right: 10px; 
    background: rgba(255,255,255,0.75);
    font-weight: bold;
    font-size: 16px;
  }
"))

title <- tags$h2(
  tag.map.title, HTML("Location of GBV Services in Rohingya Refugee Camps in Cox's Bazar, Bangladesh")
)

Add Tiles

map_rhg <- rohingya_camps %>%
  leaflet() %>%
  addTiles() %>%
  fitBounds(lng1 = min(rohingya_camps$Longitude), lat1 = min(rohingya_camps$Latitude), lng2 = max(rohingya_camps$Longitude), lat2 = max(rohingya_camps$Latitude)) %>%
  addPolygons(data = outline, lng = outline$Longitude, lat = outline$Latitude, fill = FALSE, weight = 5, color = "red", group = "Virtual boundary") %>%
  addCircleMarkers(
    lng = rohingya_camps$Longitude, lat = rohingya_camps$Latitude, group = "Rohingya camps",
    radius = 10, color = "red", opacity = 1, weight = 2,
    popup = paste0(
      "New Camp Name: ", "<strong>", '<span style="color:red">', rohingya_camps$New_Camp_Name, "</strong>", "</span>",
      "<br>", "Settlement Type: ", "<strong>", '<span style="color:red">', rohingya_camps$`Settlement Type`, "</strong>", "</span>",
      "<br>", "District Name: ", "<strong>", '<span style="color:red">', rohingya_camps$District, "</strong>", "</span>",
      "<br>", "Sub-district Name: ", "<strong>", '<span style="color:red">', rohingya_camps$Upazila, "</strong>", "</span>",
      "<br>", "Union Name: ", "<strong>", '<span style="color:red">', rohingya_camps$Union, "</strong>", "</span>",
      "<br>", "No. of total household in this camp: ", "<strong>", '<span style="color:blue">', rohingya_camps$Total_HH, "</strong>", "</span>",
      "<br>", "No. of total individuals in this camp: ", "<strong>", '<span style="color:blue">', rohingya_camps$Total_Individuals, "</strong>", "</span>",
      "<br>", "Data source <span style='color:blue'> (as of Feb 2021): <a href='https://data.humdata.org/dataset/site-location-of-rohingya-refugees-in-cox-s-bazar/resource/d947b032-aa5b-4404-9fe9-9cb7c3ac93cf'>RRRC-UNHCR </a>",
      "<br>"
    )
  ) %>%
  addProviderTiles(providers$Esri.WorldImagery, group = "World Imagery") %>%
  addProviderTiles(providers$Stamen.TonerLite, group = "Toner Lite") %>%
  addProviderTiles(providers$OpenStreetMap, group = "Open SM") %>%
  addGraticule(group = "Graticule", interval = 0.02, style = list(color = "#FF0000", weight = 1)) %>%
  addCircleMarkers(
    lng = gbv_camps$Longitude, lat = gbv_camps$Latitude, group = "Rohingya camps with GBV",
    radius = 5, color = "blue", opacity = 2, weight = 2,
    popup = paste0(
      "New Camp Name: ", "<strong>", '<span style="color:red">', gbv_camps$camp_village_location_name, "</strong>", "</span>",
      "<br>", "Settlement Type: ", "<strong>", '<span style="color:red">', gbv_camps$`Settlement Type`, "</strong>", "</span>",
      "<br>", "District Name: ", "<strong>", '<span style="color:red">', gbv_camps$District, "</strong>", "</span>",
      "<br>", "Sub-district Name: ", "<strong>", '<span style="color:red">', gbv_camps$Upazila, "</strong>", "</span>",
      "<br>", "Union Name: ", "<strong>", '<span style="color:red">', gbv_camps$Union, "</strong>", "</span>",
      "<br>", "No. of total household in this camp: ", "<strong>", '<span style="color:blue">', gbv_camps$Total_HH, "</strong>", "</span>",
      "<br>", "No. of total individuals in this camp: ", "<strong>", '<span style="color:blue">', gbv_camps$Total_Individuals, "</strong>", "</span>",
      "<br>", "Total individuals reached by GBV in this camp: ", "<strong>", '<span style="color:green">', gbv_camps$reached_total_individuals, "</strong>", "</span>",
      "<br>", "Total females reached by GBV in this camp: ", "<strong>", '<span style="color:green">', gbv_camps$reached_total_female_individuals, "</strong>", "</span>",
      "<br>", "Total males reached by GBV in this camp: ", "<strong>", '<span style="color:green">', gbv_camps$reached_total_male_individuals, "</strong>", "</span>",
      "<br>", "Total girls GBV beneficiaries <18 in this camp: ", "<strong>", '<span style="color:green">', gbv_camps$total_girls_beneficiaries_below_18, "</strong>", "</span>",
      "<br>", "Total boys GBV beneficiaries <18 in this camp: ", "<strong>", '<span style="color:green">', gbv_camps$total_boys_beneficiaries_below_18, "</strong>", "</span>",
      "<br>", "Total women GBV benef. 18-59 in this camp: ", "<strong>", '<span style="color:green">', gbv_camps$total_women_beneficiaries_18_59, "</strong>", "</span>",
      "<br>", "Total men GBV beneficiaries 18-59 in this camp: ", "<strong>", '<span style="color:green">', gbv_camps$total_men_beneficiaries_18_59, "</strong>", "</span>",
      "<br>", "Total women GBV beneficiaries >59 in this camp: ", "<strong>", '<span style="color:green">', gbv_camps$total_elderly_women_beneficiaries_above_59, "</strong>", "</span>",
      "<br>", "Total men GBV beneficiaries >59 in this camp: ", "<strong>", '<span style="color:green">', gbv_camps$total_elderly_men_beneficiaries_above_59, "</strong>", "</span>",
      "<br>", "No of GBV implementing partner in this camp: ", "<strong>", '<span style="color:green">', gbv_camps$no_implementing_partner, "</strong>", "</span>",
      "<br>", "Data source <span style='color:blue'> (as of Feb 2021): <a href='https://data.humdata.org/dataset/site-location-of-rohingya-refugees-in-cox-s-bazar/resource/d947b032-aa5b-4404-9fe9-9cb7c3ac93cf'>RRRC-UNHCR </a>",
      "<br>"
    )
  ) %>%
  addCircleMarkers(
    lng = cpi_camps$Longitude, lat = cpi_camps$Latitude, group = "CPI camps with GBV in 2019",
    radius = 1, color = "pink", opacity = 1, weight = 2, label = "CPI Camp", 
    labelOptions = labelOptions(noHide = TRUE, textOnly = FALSE, 
                                textsize = "15px", style = list("color"="red")))%>%
  #Layers Control
  addLayersControl(baseGroups = c("Open SM", "Toner Lite", "World Imagery"), 
                   overlayGroups = c("Virtual boundary", "Graticule", "Rohingya camps", "Rohingya camps with GBV", "CPI camps with GBV in 2019"), 
                   options = layersControlOptions(collapsed = FALSE)) %>%
  hideGroup(c("Virtual boundary", "Graticule","CPI camps with GBV in 2019")) %>%
  addControl(title, position = "topleft", className = "map-title") %>%
  addMiniMap(toggleDisplay = TRUE, tiles = providers$OpenStreetMap)%>%
  addMeasure(
    position = 'bottomleft',
    primaryLengthUnit = 'meters',
    primaryAreaUnit = 'sqmeters',
    activeColor = '#3D535D',
    completedColor = '#7D4479') %>%
  addControl("<P><b>Steps to measure distances and areas</b>
  <br/>Click on left bottom icon to popup <br/>Click at least 2 points to see distance <br> Click at least 3 points to measure area<br> </P>",
             position = 'topright') %>%
  addResetMapButton() %>%
  leaflet.extras::addSearchFeatures(targetGroups = 'Rohingya camps with GBV',
    options = searchFeaturesOptions(zoom = 15,
                                    openPopup = TRUE,
                                    firstTipSubmit = TRUE,
                                    autoCollapse = TRUE,
                                    hideMarkerOnCollapse = TRUE))

Rendering Map

map_rhg

Figure 1: Different GBV Services in Ruhingya Camp, Cox’s Bazar, Bangladesh

Distances between Refugee Camps in Cox’s Bazar

res <- geosphere::distm(gbv_camps[c("Longitude","Latitude")],gbv_camps[c("Longitude","Latitude")])*0.0006213712
rownames(res) = gbv_camps$camp_village_location_name
colnames(res) = gbv_camps$camp_village_location_name
dis_camps <- reactable::reactable(
  res,
  showSortIcon = FALSE,
  compact = TRUE,
  pagination = TRUE)
htmlwidgets::prependContent(dis_camps, 
                            h3(class = "title", "Table 2: Distances (in miles) between camps in Ruhingya Refugee Camps in Cox's Bazar"))

Table 2: Distances (in miles) between camps in Ruhingya Refugee Camps in Cox's Bazar