show code
pacman::p_load(tmap, sf, sfdep, tidyverse, plotly, zoo, Kendall)November 25, 2023
November 30, 2023
This function calls pacman to load sf, tidyverse, tmap, knitr packages;
tmap : For thematic mapping; powerful mapping packagesf : for geospatial data handling, but also geoprocessing: buffer, point-in-polygon count, etc
sfdep : creates space-time cube, EHSA; replaces spdeptidyverse : for non-spatial data handling; commonly used R packageplotly : makes R graphs interactive; zoom, onmouseover details
p is a ggplot objectHunan: geospatial dataset in ESRI shapefile format
st_read() to import assf data.frame
$geometry column is actually a list inside the df cell; that’s the power of the tibble dataframesimple features refers to geometric features eg point line curve etcWGS84; see `88Hunan_GDPPC.csv: attribute format in csv format
sf dataframe (eg you can also hunan2012 right join hunan)
sf dataframe, normal tibble dataframe will drop the geometry columnReading layer `Hunan' from data source
`C:\1darren\ISSS624\In-class_Ex\In-class_Ex2\data\geospatial'
using driver `ESRI Shapefile'
Simple feature collection with 88 features and 7 fields
Geometry type: POLYGON
Dimension: XY
Bounding box: xmin: 108.7831 ymin: 24.6342 xmax: 114.2544 ymax: 30.12812
Geodetic CRS: WGS 84
spacetime() function;
.loc_col, .time_col _ Use is_spacetime_cube() to confirm operation performed successfullyGDPPC and GDPPC_st object look very similar, oclumns etc;activate on each time-period, reconsider the geometry column for future calculations
nb, wt has redundant info; however, this will be needed for Gi* calculations over timeinclude_self into nb matrix togroup_by(Year) to analyse year by yeartidyr::unnest to expand output of local_gstar_perm functionehsa has 88 rows; 10 years’ data condensed down by individual region
ehsa$classification shows classification of region into sporadic coldspot, oscillating hotspot etcafter plot, some have “no pattern”
note that NO PATTERN and NO VALUE is different;