Skip to contents

This function aggregates grocery store counts and computes additional variables based on raw census data. The function does not require any arguments but does require internet access.

Usage

prepare_data()

Format

A sf dataframe with 49 columns, the additional columns compared to the raw grocery_DA:

hsr_level

The quantile level transit stop number in that census DA (high, mid, or low)

n_hsr_stops

The transit stop number in that census DA

n_hsr_stops_density

The transit stop density per square kilometres in that census DA

pop_density

Population density per square kilometres

log_pop_density

Natural log of population density per square kilometres plus 1

log_area

Natural log of land area in square kilometres

dist_to_downtown

Euclidean distance from census DA centroid to Hamilton downton in metres

log_dist_to_downtown

Natural log of Euclidean distance from census DA centroid to Hamilton downton in metres

PCT_aged_under_24

Percentage of residents aged under 24 years old

PCT_aged_above_65

Percentage of residents aged above 65 years old

PCT_single_detached

Percentage of residents living in single detached houses

PCT_married_common_law

Percentage of residents married or living in common law

PCT_income_less_40k

Percentage of residents have household income less than 40k

PCT_income_greater_100k

Percentage of residents have household income greater than 100k

PCT_dont_know_official_language

Percentage of residents don't know/speak official languages

PCT_not_speak_offcial_language_at_home

Percentage of residents don't speak official languages at home

Value

a data frame based on grocery_DA with additional variables

Author

Zehui Yin, yinz39@mcmaster.ca

Examples

grocery_DA <- prepare_data()
summary(grocery_DA[,c("Freq", "PCT_single_detached")])
#>       Freq         PCT_single_detached          geometry  
#>  Min.   :0.00000   Min.   :  0.00      MULTIPOLYGON :891  
#>  1st Qu.:0.00000   1st Qu.: 37.86      epsg:26917   :  0  
#>  Median :0.00000   Median : 72.44      +proj=utm ...:  0  
#>  Mean   :0.09877   Mean   : 63.79                         
#>  3rd Qu.:0.00000   3rd Qu.: 93.94                         
#>  Max.   :4.00000   Max.   :104.17                         
#>                    NA's   :4