1 Overview

This take-home exercise 1 (Alt.) is to analyse and examine the geographic distribution childcare services and the changes between 2017 and 2020 by using appropriate map analysis and spatial point patterns analysis techniques to demonostrate Geo-spatial Data Wrangling, Geo-spatial Analysis and Geo-Visualisation.

2 The Data Set

The selected dataset retrieved and available in open source (data.gov.sg) is being used for the exercises - The childcare services data set in 2017 and 2020 - URA Master Plan 2014 Planning Subzone GIS data - Singapore Residents by Planning AreaSubzone, Age Group, Sex and Type of Dwelling, June 2011-2019 from Singapore Department of Statistics.

3 Part 0: Setting Up Working Environment

This code chunk will check if the R packages in the packaging list have been installed. if no, go ahead to install the missing one. After the installation, it will also load the R packages in R.

#c is creating a list to a packages
#"<-" && "=" serves as the same function

packages <- c('sp', 'rgdal', 'rgeos', 'sf', 'tmap', 'tidyverse', 'haven', 'readxl')
for (p in packages){  
  if(!require(p, character.only = T)){
    install.packages(p)
  }
  library(p, character.only = T)
}

4 Part 1: Geospatial Data Wrangling

4.1 Loading up the Geospatial Data

Working with sf packages on the dataset below: - MP14_SUBZONE_WEB_PL - a polygon feature layer in ESRI shapefile format, - CHILDCARE - for 2017 data, a line feature layer in ESRI shapefile format, and - child-care-services-kml - for 2020 data, a point feature layer in kml file format.

The code chunk below uses st_read() function of sf package to import the datas into R as simple feature dataframes. And also import data by using read_csv() of readr package. Read_excel is being used for the excel format of “xls” & “xlsx”. While “csv” uses read_csv.

childcare_2017_sf = st_read(dsn = "data/geospatial", "CHILDCARE")
## Reading layer `CHILDCARE' from data source `D:\Google Drive\SMU\Year 4\Term 1\IS415-Geospatial Analytics and Applications\Take Home Exercises\IS415_Take-home_Ex01\Data\geospatial' using driver `ESRI Shapefile'
## Simple feature collection with 1312 features and 18 fields
## geometry type:  POINT
## dimension:      XY
## bbox:           xmin: 11203.01 ymin: 25667.6 xmax: 45404.24 ymax: 49300.88
## projected CRS:  SVY21
childcare_2020_sf = st_read("data/geospatial/child-care-services-kml.kml")
## Reading layer `CHILDCARE' from data source `D:\Google Drive\SMU\Year 4\Term 1\IS415-Geospatial Analytics and Applications\Take Home Exercises\IS415_Take-home_Ex01\Data\geospatial\child-care-services-kml.kml' using driver `KML'
## Simple feature collection with 1545 features and 2 fields
## geometry type:  POINT
## dimension:      XYZ
## bbox:           xmin: 103.6824 ymin: 1.248403 xmax: 103.9897 ymax: 1.462134
## z_range:        zmin: 0 zmax: 0
## geographic CRS: WGS 84
popdata <- read_csv("data/aspatial/respopagesextod2011to2019.csv")

From the simple Feature DataFrame,since we know its from Singapore database, there is no need to transform. EPSG: 3414 is Singapore SVY21 Projected Coordinate System We will simply set the CRS to 3414 in correspondence to SG.

# childcare_2017_sf <- st_as_sf(childcare_2017_sf)
# childcare_2017_sf <- st_transform(childcare_2017_sf, crs= 3414)
# 
# childcare_2020_sf <- st_as_sf(childcare_2020_sf)
# childcare_2020_sf <- st_transform(childcare_2020_sf, crs= 3414)

childcare_2017_sf <- st_as_sf(childcare_2017_sf, coords = c("X_ADDR", "Y_ADDR"), crs = 3414)
childcare_2020_sf <- st_as_sf(childcare_2020_sf, coords = c("X_ADDR", "Y_ADDR"), crs = 3414)

test_2017 <- st_is_valid(childcare_2017_sf)
test_2019 <- st_is_valid(childcare_2020_sf)

#st_crs(childcare_2017_sf)
#st_crs(childcare_2020_sf)

NA/Validity Checks 1

childcare_2017_sf[rowSums(is.na(childcare_2017_sf))!=0,]
## Simple feature collection with 1312 features and 18 fields
## geometry type:  POINT
## dimension:      XY
## bbox:           xmin: 11203.01 ymin: 25667.6 xmax: 45404.24 ymax: 49300.88
## projected CRS:  SVY21
## First 10 features:
##    OBJECTID ADDRESSBLO ADDRESSBUI ADDRESSPOS
## 1         1       <NA>       <NA>     387908
## 2         2       <NA>       <NA>     489773
## 3         3       <NA>       <NA>     569880
## 4         4       <NA>       <NA>     520114
## 5         5       <NA>       <NA>     437157
## 6         6       <NA>       <NA>     760925
## 7         7       <NA>       <NA>     159837
## 8         8       <NA>       <NA>     129040
## 9         9       <NA>       <NA>     787013
## 10       10       <NA>       <NA>     680229
##                                                                 ADDRESSSTR
## 1                                    11 LORONG 37 GEYLANG SINGAPORE 387908
## 2                                      13 BEDOK RIA PLACE SINGAPORE 489773
## 3       7030 ANG MO KIO AVENUE 5 #01 - 46 NORTHSTAR @ AMK SINGAPORE 569880
## 4                        Blk 114 SIMEI STREET 1 #01 - 614 SINGAPORE 520114
## 5             11 TANJONG KATONG ROAD #03 - 19 & 40 ONE KM SINGAPORE 437157
## 6                      Blk 925 YISHUN CENTRAL 1 #05 - 227 SINGAPORE 760925
## 7  3500A BUKIT MERAH CENTRAL BUKIT MERAH SWIMMING COMPLEX SINGAPORE 159837
## 8                            60 FABER TERRACE FABER HILLS SINGAPORE 129040
## 9                                     1 Springside Avenue SINGAPORE 787013
## 10                Blk 229 CHOA CHU KANG CENTRAL #01 - 139 SINGAPORE 680229
##    ADDRESSTYP          DESCRIPTIO
## 1        <NA> Child Care Services
## 2        <NA> Child Care Services
## 3        <NA> Child Care Services
## 4        <NA> Child Care Services
## 5        <NA> Child Care Services
## 6        <NA> Child Care Services
## 7        <NA> Child Care Services
## 8        <NA> Child Care Services
## 9        <NA> Child Care Services
## 10       <NA> Child Care Services
##                                                                              HYPERLINK
## 1  http://www.childcarelink.gov.sg/ccls/chdcentpart/ChdCentPartLnk.jsp?centreCd=PT8785
## 2  http://www.childcarelink.gov.sg/ccls/chdcentpart/ChdCentPartLnk.jsp?centreCd=PT8344
## 3  http://www.childcarelink.gov.sg/ccls/chdcentpart/ChdCentPartLnk.jsp?centreCd=PT9034
## 4  http://www.childcarelink.gov.sg/ccls/chdcentpart/ChdCentPartLnk.jsp?centreCd=PT8947
## 5  http://www.childcarelink.gov.sg/ccls/chdcentpart/ChdCentPartLnk.jsp?centreCd=PT8575
## 6  http://www.childcarelink.gov.sg/ccls/chdcentpart/ChdCentPartLnk.jsp?centreCd=PT8712
## 7  http://www.childcarelink.gov.sg/ccls/chdcentpart/ChdCentPartLnk.jsp?centreCd=PT8636
## 8  http://www.childcarelink.gov.sg/ccls/chdcentpart/ChdCentPartLnk.jsp?centreCd=PT8500
## 9  http://www.childcarelink.gov.sg/ccls/chdcentpart/ChdCentPartLnk.jsp?centreCd=PT5350
## 10 http://www.childcarelink.gov.sg/ccls/chdcentpart/ChdCentPartLnk.jsp?centreCd=PT1970
##    LANDXADDRE LANDYADDRE                                 NAME PHOTOURL
## 1           0          0               FIRST JUNIOR PRESCHOOL     <NA>
## 2           0          0   DISCOVERY KIDZ PRESCHOOL PTE. LTD.     <NA>
## 3           0          0 DISCOVERY PLANET LIMITED PARTNERSHIP     <NA>
## 4           0          0 DISCOVERY WHIZ KIDZ EMPIRE PTE. LTD.     <NA>
## 5           0          0            DNC (EDUCATION) PTE. LTD.     <NA>
## 6           0          0 EAGER BEAVER SCHOOLHOUSE 1 PTE. LTD.     <NA>
## 7           0          0 EAGER BEAVER SCHOOLHOUSE 2 PTE. LTD.     <NA>
## 8           0          0 EAGER BEAVER SCHOOLHOUSE 3 PTE. LTD.     <NA>
## 9           0          0    EAGLE RETIREMENT PLANNERS PTE LTD     <NA>
## 10          0          0        EARLY LEARNING CENTRE PTE LTD     <NA>
##    ADDRESSFLO          INC_CRC FMEL_UPD_D ADDRESSUNI   X_ADDR   Y_ADDR
## 1        <NA> 45DBE80EB321A9B5 2016-12-23       <NA> 34246.67 33141.02
## 2        <NA> B80CD6C30B33E468 2016-12-23       <NA> 41122.34 34355.95
## 3        <NA> 53490A27EDC8D9BC 2016-12-23       <NA> 32682.01 39989.33
## 4        <NA> 7B670850834DEECE 2016-12-23       <NA> 41034.07 36221.83
## 5        <NA> 5373FE2C921B956A 2016-12-23       <NA> 34806.74 32997.58
## 6        <NA> D235B3C404A4D74D 2016-12-23       <NA> 28423.63 45471.82
## 7        <NA> C34C57B890E3BF38 2016-12-23       <NA> 26303.87 29388.70
## 8        <NA> 195E37392C1025D2 2016-12-23       <NA> 19550.92 33770.18
## 9        <NA> 3E69660A44AE653D 2016-12-23       <NA> 26398.50 42776.08
## 10       <NA> 3D83FAFC362CEF1D 2016-12-23       <NA> 18323.41 40291.37
##                     geometry
## 1  POINT (34246.67 33141.02)
## 2  POINT (41122.34 34355.95)
## 3  POINT (32682.01 39989.33)
## 4  POINT (41034.07 36221.83)
## 5  POINT (34806.74 32997.58)
## 6  POINT (28423.63 45471.82)
## 7   POINT (26303.87 29388.7)
## 8  POINT (19550.92 33770.18)
## 9   POINT (26398.5 42776.08)
## 10 POINT (18323.41 40291.37)
childcare_2020_sf[rowSums(is.na(childcare_2020_sf))!=0,]
## Simple feature collection with 0 features and 2 fields
## bbox:           xmin: NA ymin: NA xmax: NA ymax: NA
## geographic CRS: WGS 84
## [1] Name        Description geometry   
## <0 rows> (or 0-length row.names)
popdata[rowSums(is.na(popdata))!=0,]
## # A tibble: 0 x 7
## # ... with 7 variables: PA <chr>, SZ <chr>, AG <chr>, Sex <chr>, TOD <chr>,
## #   Pop <dbl>, Time <dbl>
length(which(test_2017==FALSE))
## [1] 0
length(which(test_2019==FALSE))
## [1] 0

Replace NA found with Unknown

#childcare_2017_sf$ADDRESSPOS[is.na(childcare_2017_sf$ADDRESSPOS)] <- "UNKNOWN"
#childcare_2020_sf$ADDRESSPOS[is.na(childcare_2020_sf$ADDRESSPOS)] <- "UNKNOWN"

NA/Validity Checks 2

# childcare_2017_sf[rowSums(is.na(childcare_2017_sf))!=0,]
# childcare_2020_sf[rowSums(is.na(childcare_2020_sf))!=0,]

5 Part 2: Working with the Childcare Services, mpsz and popdata DF set

Next, we requires to gather and translate the Postal Code to the the Postal District in childcare 2017 & 2020 data set in order to plot the choropleth map.

chd_2017 = st_read(dsn = "data/geospatial", "CHILDCARE")
## Reading layer `CHILDCARE' from data source `D:\Google Drive\SMU\Year 4\Term 1\IS415-Geospatial Analytics and Applications\Take Home Exercises\IS415_Take-home_Ex01\Data\geospatial' using driver `ESRI Shapefile'
## Simple feature collection with 1312 features and 18 fields
## geometry type:  POINT
## dimension:      XY
## bbox:           xmin: 11203.01 ymin: 25667.6 xmax: 45404.24 ymax: 49300.88
## projected CRS:  SVY21
chd_2017 <- st_as_sf(chd_2017)
chd_2017 <- st_transform(chd_2017, crs= 3414)

chd_2017_pd <- chd_2017 %>%
  #transmute(ADDRESSPOS = ADDRESSPOS[0:2][0:1312])
  mutate(ADDRESSPOSNEW = case_when(
    between(ADDRESSPOS, 010000, 069999) ~ 1,
    between(ADDRESSPOS, 070000, 089999) ~ 2,
    between(ADDRESSPOS, 140000, 169999) ~ 3,
    between(ADDRESSPOS, 090000, 109999) ~ 4,
    between(ADDRESSPOS, 110000, 139999) ~ 5,
    between(ADDRESSPOS, 170000, 179999) ~ 6,
    between(ADDRESSPOS, 180000, 199999) ~ 7,
    between(ADDRESSPOS, 200000, 219999) ~ 8,
    between(ADDRESSPOS, 220000, 239999) ~ 9,
    between(ADDRESSPOS, 240000, 279999) ~ 10,
    between(ADDRESSPOS, 280000, 309999) ~ 11,
    between(ADDRESSPOS, 310000, 339999) ~ 12,
    between(ADDRESSPOS, 340000, 379999) ~ 13,
    between(ADDRESSPOS, 380000, 419999) ~ 14,
    between(ADDRESSPOS, 420000, 459999) ~ 15,
    between(ADDRESSPOS, 460000, 489999) ~ 16,
    between(ADDRESSPOS, 490000, 509999) ~ 17,
    between(ADDRESSPOS, 810000, 819999) ~ 17,
    between(ADDRESSPOS, 510000, 529999) ~ 18,
    between(ADDRESSPOS, 530000, 559999) ~ 19,
    between(ADDRESSPOS, 820000, 829999) ~ 19,
    between(ADDRESSPOS, 560000, 579999) ~ 20,
    between(ADDRESSPOS, 580000, 599999) ~ 21,
    between(ADDRESSPOS, 600000, 649999) ~ 22,
    between(ADDRESSPOS, 650000, 689999) ~ 23,
    between(ADDRESSPOS, 690000, 719999) ~ 24,
    between(ADDRESSPOS, 720000, 739999) ~ 25,
    between(ADDRESSPOS, 770000, 789999) ~ 26,
    between(ADDRESSPOS, 750000, 769999) ~ 27,
    between(ADDRESSPOS, 790000, 809999) ~ 28
  ))

#childcare_2017$new_col <- with(childcare_2017, if(childcare['ADDRESSPOS'][0:2] == 01, 0))

# Generate a descriptive postal sector
# generateDescriptiveName <- function(geo.row){
#   geoList1.vector <- c("01", "02", "03", "04", "05", "06")
#   geoList2.vector <- c("07", "08")
#   geoList3.vector <- c("14", "15", "16")
#   geoList4.vector <- c("9", "10")
#   geoList5.vector <- c("11", "12")
#   geoList6.vector <- c("38", "39", "40", "41")

5.1 Loading in Planning Area Subzone geospatial data

Transform for a easier to read format

mpsz_sf = st_read(dsn = "data/geospatial", layer = "MP14_SUBZONE_WEB_PL")
## Reading layer `MP14_SUBZONE_WEB_PL' from data source `D:\Google Drive\SMU\Year 4\Term 1\IS415-Geospatial Analytics and Applications\Take Home Exercises\IS415_Take-home_Ex01\Data\geospatial' using driver `ESRI Shapefile'
## Simple feature collection with 323 features and 15 fields
## geometry type:  MULTIPOLYGON
## dimension:      XY
## bbox:           xmin: 2667.538 ymin: 15748.72 xmax: 56396.44 ymax: 50256.33
## projected CRS:  SVY21
mpsz_sf <- st_as_sf(mpsz_sf)
mpsz_sf <- st_transform(mpsz_sf, crs= 3414)

#st_crs(mpsz_sf)

NA/Validity Check 3

mpsz_sf[rowSums(is.na(mpsz_sf))!=0,]
## Simple feature collection with 0 features and 15 fields
## bbox:           xmin: NA ymin: NA xmax: NA ymax: NA
## projected CRS:  SVY21 / Singapore TM
##  [1] OBJECTID   SUBZONE_NO SUBZONE_N  SUBZONE_C  CA_IND     PLN_AREA_N
##  [7] PLN_AREA_C REGION_N   REGION_C   INC_CRC    FMEL_UPD_D X_ADDR    
## [13] Y_ADDR     SHAPE_Leng SHAPE_Area geometry  
## <0 rows> (or 0-length row.names)
test_mpsz_sf <- st_is_valid(mpsz_sf)
length(which(test_mpsz_sf==FALSE))
## [1] 9

sf package to fix polygons

mpsz_sf <- st_make_valid(mpsz_sf)

5.2 Joining the Attribute data and Aspatial data.

  • Extract 2017 & 2019* records only
  • Assume Childcare Services are for children below the age of 9
  • Extract 0_to_4, 5_to_9 records only
  • Derive two new variables

We will be utilising 2017 and 2019 population of child with the age of 0_to_4 and 5_to_9 as there are still kids that falls within the range so we may also need to take in account of age 8 and 9 later on. As for the 2020 population records are not yet available on data.gov.sg, so we will use 2019 records in the Childcare Services data set to gauge for year 2020.

Selecting the requirements for Child’s Population data set:

popagsex2017 <- popdata %>%
  filter(Time == 2017) %>%
  filter(AG == '0_to_4' | AG == '5_to_9')%>%
  spread(TOD, Pop) %>%
  mutate('Total' = rowSums(.[6:13])) %>%
  select('PA', 'SZ', 'AG', 'Sex', 'Time', 'Total') %>%
  spread(Sex, Total) %>%
  mutate('Total' = rowSums(.[5:6])) %>%
  select('PA','SZ', 'AG', 'Time', 'Total') %>%
  spread(AG, Total) %>%
  mutate('Total' = rowSums(.[4:5])) %>%
  mutate('Demand' = Total / sum(Total) * 100) %>%
  mutate_at(.vars = vars(PA, SZ), .funs = funs(toupper)) %>%
  select('PA', 'SZ', 'Time', 'Total', 'Demand')

mpsz_popagsex2017_demand <- left_join(mpsz_sf, popagsex2017, by = c("SUBZONE_N" = "SZ"))

mpsz_popagsex2017_supply <- st_join(mpsz_sf, chd_2017_pd, join = st_intersects, suffix = c(".SUBZONE_NO", ".ADDRESSPOSNO"))

# by = c("SUBZONE_NO" = "ADDRESSPOSNO")
#mpsz_popagsex2017_supply <- st_join(mpsz_sf, childcare_2017_sf_pd, by = c("SUBZONE_NO" = "ADDRESSPOSNO"))
popagsex2019 <- popdata %>%
  filter(Time == 2019) %>%
  filter(AG == '0_to_4' | AG == '5_to_9') %>%
  spread(TOD, Pop) %>%
  mutate('Total' = rowSums(.[6:13])) %>%
  select('PA', 'SZ', 'AG', 'Sex', 'Time', 'Total') %>%
  spread(Sex, Total) %>%
  mutate('Total' = rowSums(.[5:6])) %>%
  select('PA','SZ', 'AG', 'Time', 'Total') %>%
  spread(AG, Total) %>%
  mutate('Total' = rowSums(.[4:5])) %>%
  mutate('Demand' = Total / sum(Total) * 100) %>%
  mutate_at(.vars = vars(PA, SZ), .funs = funs(toupper)) %>%
  select('PA', 'SZ', 'Time', 'Total', 'Demand')

mpsz_popagsex2019 <- left_join(mpsz_sf, popagsex2019, by = c("SUBZONE_N" = "SZ"))

Remove duplicate rows in a data frame

#mpsz_popagsex2017 %>% distinct()
#mpsz_popagsex2020 %>% distinct()

unique(mpsz_popagsex2017_demand)
## Simple feature collection with 323 features and 19 fields
## geometry type:  GEOMETRY
## dimension:      XY
## bbox:           xmin: 2667.538 ymin: 15748.72 xmax: 56396.44 ymax: 50256.33
## projected CRS:  SVY21 / Singapore TM
## First 10 features:
##    OBJECTID SUBZONE_NO       SUBZONE_N SUBZONE_C CA_IND      PLN_AREA_N
## 1         1          1    MARINA SOUTH    MSSZ01      Y    MARINA SOUTH
## 2         2          1    PEARL'S HILL    OTSZ01      Y          OUTRAM
## 3         3          3       BOAT QUAY    SRSZ03      Y SINGAPORE RIVER
## 4         4          8  HENDERSON HILL    BMSZ08      N     BUKIT MERAH
## 5         5          3         REDHILL    BMSZ03      N     BUKIT MERAH
## 6         6          7  ALEXANDRA HILL    BMSZ07      N     BUKIT MERAH
## 7         7          9   BUKIT HO SWEE    BMSZ09      N     BUKIT MERAH
## 8         8          2     CLARKE QUAY    SRSZ02      Y SINGAPORE RIVER
## 9         9         13 PASIR PANJANG 1    QTSZ13      N      QUEENSTOWN
## 10       10          7       QUEENSWAY    QTSZ07      N      QUEENSTOWN
##    PLN_AREA_C       REGION_N REGION_C          INC_CRC FMEL_UPD_D   X_ADDR
## 1          MS CENTRAL REGION       CR 5ED7EB253F99252E 2014-12-05 31595.84
## 2          OT CENTRAL REGION       CR 8C7149B9EB32EEFC 2014-12-05 28679.06
## 3          SR CENTRAL REGION       CR C35FEFF02B13E0E5 2014-12-05 29654.96
## 4          BM CENTRAL REGION       CR 3775D82C5DDBEFBD 2014-12-05 26782.83
## 5          BM CENTRAL REGION       CR 85D9ABEF0A40678F 2014-12-05 26201.96
## 6          BM CENTRAL REGION       CR 9D286521EF5E3B59 2014-12-05 25358.82
## 7          BM CENTRAL REGION       CR 7839A8577144EFE2 2014-12-05 27680.06
## 8          SR CENTRAL REGION       CR 48661DC0FBA09F7A 2014-12-05 29253.21
## 9          QT CENTRAL REGION       CR 1F721290C421BFAB 2014-12-05 22077.34
## 10         QT CENTRAL REGION       CR 3580D2AFFBEE914C 2014-12-05 24168.31
##      Y_ADDR SHAPE_Leng SHAPE_Area              PA Time Total    Demand
## 1  29220.19   5267.381  1630379.3    MARINA SOUTH 2017     0 0.0000000
## 2  29782.05   3506.107   559816.2          OUTRAM 2017   520 0.1336211
## 3  29974.66   1740.926   160807.5 SINGAPORE RIVER 2017     0 0.0000000
## 4  29933.77   3313.625   595428.9     BUKIT MERAH 2017   950 0.2441155
## 5  30005.70   2825.594   387429.4     BUKIT MERAH 2017  1420 0.3648885
## 6  29991.38   4428.913  1030378.8     BUKIT MERAH 2017  1100 0.2826601
## 7  30230.86   3275.312   551732.0     BUKIT MERAH 2017  1310 0.3366225
## 8  30222.86   2208.619   290184.7 SINGAPORE RIVER 2017     0 0.0000000
## 9  29893.78   6571.323  1084792.3      QUEENSTOWN 2017   400 0.1027855
## 10 30104.18   3454.239   631644.3      QUEENSTOWN 2017     0 0.0000000
##                          geometry
## 1  MULTIPOLYGON (((31495.56 30...
## 2  MULTIPOLYGON (((29092.28 30...
## 3  MULTIPOLYGON (((29932.33 29...
## 4  MULTIPOLYGON (((27131.28 30...
## 5  MULTIPOLYGON (((26451.03 30...
## 6  MULTIPOLYGON (((25899.7 297...
## 7  MULTIPOLYGON (((27746.95 30...
## 8  MULTIPOLYGON (((29351.26 29...
## 9  MULTIPOLYGON (((20996.49 30...
## 10 MULTIPOLYGON (((24472.11 29...
unique(mpsz_popagsex2017_supply)
## Simple feature collection with 1416 features and 34 fields
## geometry type:  GEOMETRY
## dimension:      XY
## bbox:           xmin: 2667.538 ymin: 15748.72 xmax: 56396.44 ymax: 50256.33
## projected CRS:  SVY21 / Singapore TM
## First 10 features:
##     OBJECTID.SUBZONE_NO SUBZONE_NO      SUBZONE_N SUBZONE_C CA_IND
## 1                     1          1   MARINA SOUTH    MSSZ01      Y
## 2                     2          1   PEARL'S HILL    OTSZ01      Y
## 2.1                   2          1   PEARL'S HILL    OTSZ01      Y
## 2.2                   2          1   PEARL'S HILL    OTSZ01      Y
## 2.3                   2          1   PEARL'S HILL    OTSZ01      Y
## 2.4                   2          1   PEARL'S HILL    OTSZ01      Y
## 3                     3          3      BOAT QUAY    SRSZ03      Y
## 4                     4          8 HENDERSON HILL    BMSZ08      N
## 4.1                   4          8 HENDERSON HILL    BMSZ08      N
## 5                     5          3        REDHILL    BMSZ03      N
##          PLN_AREA_N PLN_AREA_C       REGION_N REGION_C INC_CRC.SUBZONE_NO
## 1      MARINA SOUTH         MS CENTRAL REGION       CR   5ED7EB253F99252E
## 2            OUTRAM         OT CENTRAL REGION       CR   8C7149B9EB32EEFC
## 2.1          OUTRAM         OT CENTRAL REGION       CR   8C7149B9EB32EEFC
## 2.2          OUTRAM         OT CENTRAL REGION       CR   8C7149B9EB32EEFC
## 2.3          OUTRAM         OT CENTRAL REGION       CR   8C7149B9EB32EEFC
## 2.4          OUTRAM         OT CENTRAL REGION       CR   8C7149B9EB32EEFC
## 3   SINGAPORE RIVER         SR CENTRAL REGION       CR   C35FEFF02B13E0E5
## 4       BUKIT MERAH         BM CENTRAL REGION       CR   3775D82C5DDBEFBD
## 4.1     BUKIT MERAH         BM CENTRAL REGION       CR   3775D82C5DDBEFBD
## 5       BUKIT MERAH         BM CENTRAL REGION       CR   85D9ABEF0A40678F
##     FMEL_UPD_D.SUBZONE_NO X_ADDR.SUBZONE_NO Y_ADDR.SUBZONE_NO SHAPE_Leng
## 1              2014-12-05          31595.84          29220.19   5267.381
## 2              2014-12-05          28679.06          29782.05   3506.107
## 2.1            2014-12-05          28679.06          29782.05   3506.107
## 2.2            2014-12-05          28679.06          29782.05   3506.107
## 2.3            2014-12-05          28679.06          29782.05   3506.107
## 2.4            2014-12-05          28679.06          29782.05   3506.107
## 3              2014-12-05          29654.96          29974.66   1740.926
## 4              2014-12-05          26782.83          29933.77   3313.625
## 4.1            2014-12-05          26782.83          29933.77   3313.625
## 5              2014-12-05          26201.96          30005.70   2825.594
##     SHAPE_Area OBJECTID.ADDRESSPOSNO ADDRESSBLO ADDRESSBUI ADDRESSPOS
## 1    1630379.3                    NA       <NA>       <NA>       <NA>
## 2     559816.2                   679       <NA>       <NA>     160054
## 2.1   559816.2                   972       <NA>       <NA>     169016
## 2.2   559816.2                   978       <NA>       <NA>     169039
## 2.3   559816.2                  1116       <NA>       <NA>     169051
## 2.4   559816.2                  1125       <NA>       <NA>     169043
## 3     160807.5                    NA       <NA>       <NA>       <NA>
## 4     595428.9                   269       <NA>       <NA>     152120
## 4.1   595428.9                   821       <NA>       <NA>     150106
## 5     387429.4                   407       <NA>       <NA>     159465
##                                                                           ADDRESSSTR
## 1                                                                               <NA>
## 2                  54 CHIN SWEE ROAD #01 - 22 CHIN SWEE AREA OFFICE SINGAPORE 160054
## 2.1                    1A PEARL BANK #01 - 10 PEARL BANK APARTMENTS SINGAPORE 169016
## 2.2                                                 226 Outram Road SINGAPORE 169039
## 2.3                                                 254 OUTRAM ROAD SINGAPORE 169051
## 2.4                                    Blk 240 OUTRAM ROAD #05 - 01 SINGAPORE 169043
## 3                                                                               <NA>
## 4                              Blk 120 BUKIT MERAH VIEW #01 - 04/06 SINGAPORE 152120
## 4.1                             Blk 106 HENDERSON CRESCENT #01 - 37 SINGAPORE 150106
## 5   4000 JALAN BUKIT MERAH #02 - 07/08 BUKIT MERAH COMMUNITY CENTRE SINGAPORE 159465
##     ADDRESSTYP          DESCRIPTIO
## 1         <NA>                <NA>
## 2         <NA> Child Care Services
## 2.1       <NA> Child Care Services
## 2.2       <NA> Child Care Services
## 2.3       <NA> Child Care Services
## 2.4       <NA> Child Care Services
## 3         <NA>                <NA>
## 4         <NA> Child Care Services
## 4.1       <NA> Child Care Services
## 5         <NA> Child Care Services
##                                                                               HYPERLINK
## 1                                                                                  <NA>
## 2   http://www.childcarelink.gov.sg/ccls/chdcentpart/ChdCentPartLnk.jsp?centreCd=NT0547
## 2.1 http://www.childcarelink.gov.sg/ccls/chdcentpart/ChdCentPartLnk.jsp?centreCd=PT8565
## 2.2 http://www.childcarelink.gov.sg/ccls/chdcentpart/ChdCentPartLnk.jsp?centreCd=WP0660
## 2.3 http://www.childcarelink.gov.sg/ccls/chdcentpart/ChdCentPartLnk.jsp?centreCd=YW0070
## 2.4 http://www.childcarelink.gov.sg/ccls/chdcentpart/ChdCentPartLnk.jsp?centreCd=PT9124
## 3                                                                                  <NA>
## 4   http://www.childcarelink.gov.sg/ccls/chdcentpart/ChdCentPartLnk.jsp?centreCd=RC1715
## 4.1 http://www.childcarelink.gov.sg/ccls/chdcentpart/ChdCentPartLnk.jsp?centreCd=NT0510
## 5   http://www.childcarelink.gov.sg/ccls/chdcentpart/ChdCentPartLnk.jsp?centreCd=PT9044
##     LANDXADDRE LANDYADDRE                                         NAME PHOTOURL
## 1           NA         NA                                         <NA>     <NA>
## 2            0          0                               MY FIRST SKOOL     <NA>
## 2.1          0          0 THE LITTLE SKOOL-HOUSE INTERNATIONAL PTE LTD     <NA>
## 2.2          0          0 THE LITTLE SKOOL-HOUSE INTERNATIONAL PTE LTD     <NA>
## 2.3          0          0         YWCA OUTRAM CHILD DEVELOPMENT CENTRE     <NA>
## 2.4          0          0        SUPERLAND PRE-SCHOOL (OUTRAM) PTE LTD     <NA>
## 3           NA         NA                                         <NA>     <NA>
## 4            0          0       HEALTHY START CHILD DEVELOPMENT CENTRE     <NA>
## 4.1          0          0                               MY FIRST SKOOL     <NA>
## 5            0          0                   KIDSCAMPUS BUKIT MERAH LLP     <NA>
##     ADDRESSFLO INC_CRC.ADDRESSPOSNO FMEL_UPD_D.ADDRESSPOSNO ADDRESSUNI
## 1         <NA>                 <NA>                    <NA>       <NA>
## 2         <NA>     788CCDD04726AFD4              2016-12-23       <NA>
## 2.1       <NA>     635CC7B8C17B6DCF              2016-12-23       <NA>
## 2.2       <NA>     1AFA678DF68D8249              2016-12-23       <NA>
## 2.3       <NA>     4F395275AC22A3E4              2016-12-23       <NA>
## 2.4       <NA>     570BBB18FEB00584              2016-12-23       <NA>
## 3         <NA>                 <NA>                    <NA>       <NA>
## 4         <NA>     7290289E3298400B              2016-12-23       <NA>
## 4.1       <NA>     6FC4390FCE8D54C4              2016-12-23       <NA>
## 5         <NA>     527E9A9E7B82566A              2016-12-23       <NA>
##     X_ADDR.ADDRESSPOSNO Y_ADDR.ADDRESSPOSNO ADDRESSPOSNEW
## 1                    NA                  NA            NA
## 2              28874.45            29983.70             3
## 2.1            28728.37            29476.45             3
## 2.2            28263.42            29621.93             3
## 2.3            28188.31            29758.42             3
## 2.4            28224.22            29698.26             3
## 3                    NA                  NA            NA
## 4              26807.78            29469.46             3
## 4.1            26770.90            30203.80             3
## 5              26053.51            29742.41             3
##                           geometry
## 1   MULTIPOLYGON (((31495.56 30...
## 2   MULTIPOLYGON (((29092.28 30...
## 2.1 MULTIPOLYGON (((29092.28 30...
## 2.2 MULTIPOLYGON (((29092.28 30...
## 2.3 MULTIPOLYGON (((29092.28 30...
## 2.4 MULTIPOLYGON (((29092.28 30...
## 3   MULTIPOLYGON (((29932.33 29...
## 4   MULTIPOLYGON (((27131.28 30...
## 4.1 MULTIPOLYGON (((27131.28 30...
## 5   MULTIPOLYGON (((26451.03 30...
unique(mpsz_popagsex2019)
## Simple feature collection with 323 features and 19 fields
## geometry type:  GEOMETRY
## dimension:      XY
## bbox:           xmin: 2667.538 ymin: 15748.72 xmax: 56396.44 ymax: 50256.33
## projected CRS:  SVY21 / Singapore TM
## First 10 features:
##    OBJECTID SUBZONE_NO       SUBZONE_N SUBZONE_C CA_IND      PLN_AREA_N
## 1         1          1    MARINA SOUTH    MSSZ01      Y    MARINA SOUTH
## 2         2          1    PEARL'S HILL    OTSZ01      Y          OUTRAM
## 3         3          3       BOAT QUAY    SRSZ03      Y SINGAPORE RIVER
## 4         4          8  HENDERSON HILL    BMSZ08      N     BUKIT MERAH
## 5         5          3         REDHILL    BMSZ03      N     BUKIT MERAH
## 6         6          7  ALEXANDRA HILL    BMSZ07      N     BUKIT MERAH
## 7         7          9   BUKIT HO SWEE    BMSZ09      N     BUKIT MERAH
## 8         8          2     CLARKE QUAY    SRSZ02      Y SINGAPORE RIVER
## 9         9         13 PASIR PANJANG 1    QTSZ13      N      QUEENSTOWN
## 10       10          7       QUEENSWAY    QTSZ07      N      QUEENSTOWN
##    PLN_AREA_C       REGION_N REGION_C          INC_CRC FMEL_UPD_D   X_ADDR
## 1          MS CENTRAL REGION       CR 5ED7EB253F99252E 2014-12-05 31595.84
## 2          OT CENTRAL REGION       CR 8C7149B9EB32EEFC 2014-12-05 28679.06
## 3          SR CENTRAL REGION       CR C35FEFF02B13E0E5 2014-12-05 29654.96
## 4          BM CENTRAL REGION       CR 3775D82C5DDBEFBD 2014-12-05 26782.83
## 5          BM CENTRAL REGION       CR 85D9ABEF0A40678F 2014-12-05 26201.96
## 6          BM CENTRAL REGION       CR 9D286521EF5E3B59 2014-12-05 25358.82
## 7          BM CENTRAL REGION       CR 7839A8577144EFE2 2014-12-05 27680.06
## 8          SR CENTRAL REGION       CR 48661DC0FBA09F7A 2014-12-05 29253.21
## 9          QT CENTRAL REGION       CR 1F721290C421BFAB 2014-12-05 22077.34
## 10         QT CENTRAL REGION       CR 3580D2AFFBEE914C 2014-12-05 24168.31
##      Y_ADDR SHAPE_Leng SHAPE_Area              PA Time Total     Demand
## 1  29220.19   5267.381  1630379.3    MARINA SOUTH 2019     0 0.00000000
## 2  29782.05   3506.107   559816.2          OUTRAM 2019   390 0.10158631
## 3  29974.66   1740.926   160807.5 SINGAPORE RIVER 2019     0 0.00000000
## 4  29933.77   3313.625   595428.9     BUKIT MERAH 2019   890 0.23182517
## 5  30005.70   2825.594   387429.4     BUKIT MERAH 2019  1230 0.32038759
## 6  29991.38   4428.913  1030378.8     BUKIT MERAH 2019   830 0.21619650
## 7  30230.86   3275.312   551732.0     BUKIT MERAH 2019  1150 0.29954937
## 8  30222.86   2208.619   290184.7 SINGAPORE RIVER 2019     0 0.00000000
## 9  29893.78   6571.323  1084792.3      QUEENSTOWN 2019   360 0.09377198
## 10 30104.18   3454.239   631644.3      QUEENSTOWN 2019     0 0.00000000
##                          geometry
## 1  MULTIPOLYGON (((31495.56 30...
## 2  MULTIPOLYGON (((29092.28 30...
## 3  MULTIPOLYGON (((29932.33 29...
## 4  MULTIPOLYGON (((27131.28 30...
## 5  MULTIPOLYGON (((26451.03 30...
## 6  MULTIPOLYGON (((25899.7 297...
## 7  MULTIPOLYGON (((27746.95 30...
## 8  MULTIPOLYGON (((29351.26 29...
## 9  MULTIPOLYGON (((20996.49 30...
## 10 MULTIPOLYGON (((24472.11 29...

5.3 Mapping to show distribution of childcare population for 2017 (age group of 0-4 & 5-9) in Singapore

Demand of Childcare services (Child Pop Count) in 2017

tm_shape(mpsz_popagsex2017_demand) + 
  tm_fill(col = "Demand",
              n = 5,
              style="jenks",
              palette = "Blues",
          title = "Child Population Count") +
  tm_layout(legend.position = c("right", "bottom")) +
  tm_borders(lwd = 0.5, alpha = 0.5) +
  tm_credits("Source: Planning Area Sub-zone boundary MP2014 from Urban Redevelopment Authorithy (URA)\n and Population data from Department of Statistics (DOS)", 
             position = c("left", "bottom"))

#tm_polygons("Demand")

Demand of Children Count based on Regions

tm_shape(mpsz_popagsex2017_demand) + 
  tm_fill("Demand", 
          style = "quantile", 
          thres.poly = 0,
          palette = "Blues",
          title = "Region Population") +
  tm_facets(by="REGION_N", free.coords = TRUE, drop.shapes = TRUE) +
  tm_layout(legend.show = FALSE, title.position = c("center", "center"),
            title.size = 20) + 
  tm_borders(alpha = 0.5)

Supply of Childcare services (Childcare Center Count) in 2017

tm_shape(mpsz_popagsex2017_supply) + 
  tm_fill(col = "ADDRESSPOSNEW",
              n = 5,
              style="jenks",
              palette = "Blues",
          title = "Childcare Center Count") +
  tm_layout(legend.position = c("right", "bottom")) +
  tm_borders(lwd = 0.5, alpha = 0.5) +
  tm_credits("Source: Planning Area Sub-zone boundary MP2014 from Urban Redevelopment Authorithy (URA)\n and Population data from Department of Statistics (DOS)", 
             position = c("left", "bottom"))

#tm_polygons("Demand")

Supply of Childcare Centre Based on Regions

tm_shape(mpsz_popagsex2017_supply) + 
  tm_fill("ADDRESSPOSNEW", 
          style = "quantile", 
          thres.poly = 0,
          palette = "Blues",
          title = "Childcare Center Count on Regional Base") +
  tm_facets(by="REGION_N", free.coords = TRUE, drop.shapes = TRUE) +
  tm_layout(legend.show = FALSE, title.position = c("center", "center"),
            title.size = 20) + 
  tm_borders(alpha = 0.5)

North the most, follow by North-East and the West

According to the results from the map above, we can see that the North and East regions stands at one of the few with highest demand for childcare services in 2017, with North East coming third.

5.4 Mapping to show distribution of childcare population for 2020 (age group of 0-4 & 5-9) in Singapore

Demand of Childcare services (Child Pop Count) in 2020

tm_shape(mpsz_popagsex2019) + 
  tm_fill(col = "Demand",
              n = 5,
              style="jenks",
              palette = "Reds",
          title = "Child Population Count") +
  tm_layout(legend.position = c("right", "bottom")) +
  tm_borders(lwd = 0.5, alpha = 0.5) +
  tm_credits("Source: Planning Area Sub-zone boundary MP2014 from Urban Redevelopment Authorithy (URA)\n and Population data from Department of Statistics (DOS)", 
             position = c("left", "bottom"))

#tm_polygons("Demand")
tm_shape(mpsz_popagsex2019) + 
  tm_fill("Demand", style = "quantile", thres.poly = 0) +
  tm_facets(by="REGION_N", free.coords = TRUE, drop.shapes = TRUE) +
  tm_layout(legend.show = FALSE, title.position = c("center", "center"),
            title.size = 20) + 
  tm_borders(alpha = 0.5)

According to the results from the map above, we can see that the North, North-East and East regions stands at one of the few with the highest demand for childcare services in 2019.

In comparison with 2017, there is a huge increase in demand in each particular individual regions as seen in the regional map above.

In addition, we can expect an increase in demand for year 2020 as results have shown that it has been expanding rapidly.

###Supply of Childcare Services in 2017:

# childcare_2017 = st_read(dsn = "data/geospatial", "CHILDCARE")
# childcare_2020 = st_read("data/geospatial/child-care-services-kml.kml")
# sf_childcare2017 <- st_as_sf(childcare_2017, coords = c("X_ADDR", "Y_ADDR"), crs = 3414)
# sf_childcare2020 <- st_as_sf(childcare_2020, coords = c("X_ADDR", "Y_ADDR"), crs = 3414)
# 
tmap_mode("view")

Childcare_2017_count <- tm_shape(childcare_2017_sf) + 
  tm_bubbles(col = "red", 
             size = 0.1, 
             border.col = "black", 
             border.lwd = 0.1)
#tmap_arrange(Childcare_2017_count, Childcare_2020_count, asp=1, ncol=2)

According to the results from the map above, we can see that areas in the central and east are quite dispersed, while there are a few clustered ones in the north, north-east and west regions.

###Supply of Childcare Services in 2020:

Childcare_2020_count <- tm_shape(childcare_2020_sf) + 
  tm_bubbles(col = "red", 
             size = 0.1, 
             border.col = "black", 
             border.lwd = 0.1)

According to the results from the map above, we can see that there are more clustered zones, especially in the North and North-East. The West and East regions have slight clusters and the Central region remained dispersed.

In comparison to the results for year 2017, there is a significant increase of supply of childcare services. This may be due to the increase of demand in those specific areas like North and North-East.

#2.0 Analytics mapping

Using appropriate analytics mapping techniques to reveal the temporal changes of the childcare services at the planning subzone level.

#3.0 Geocommunication

Describe the results of (1) and (2) and draw statistical conclusions.