Description Usage Arguments Value Examples
View source: R/geo_utilities.R
The returned multiplier can be used for each analysed point and each day to simulate a common population penetration rate across all points. The rate is given by the normalization_percentage. parameter and it defaults to 0.14, aka 14 percent. NB: this queries Athena and considers the statistics.panel table on AWS Glue being updated daily by a cronjob.
1 2 3 4 5 6 7 8 9 10 11 | dailyNormalizationCoefficients(
input_places,
start_date,
end_date,
id_column_name = "id_poi",
lon_column_name = "lon",
lat_column_name = "lat",
radius_mt = 25000,
normalization_percentage = 0.14,
country = "Italy"
)
|
input_places |
a data.frame containing for each POI a unique id, longitude and latitude |
start_date |
starting date of the coefficient |
end_date |
ending date of the coefficient |
id_column_name |
the name of the column containing the POI unique id (default id_poi) |
lon_column_name |
the name of the column containing the POI longitudee (default lon) |
lat_column_name |
the name of the column containing the POI latitude (default lat) |
radius_mt |
the radius in meters around the POI over which to compute the normalization (default 25000 mt) |
normalization_percentage |
The simulated penetration rate. Default 0.14 or 14 percent. Set to 1 to attempt an estimate of population parameter but will have huge variance. |
country |
Defaults to Italy, other countries are not implemented yet |
Returns a pivot data.frame that contains, for each POI and date, the multiplication coefficient
1 2 3 4 5 6 7 8 | library(alexr)
library(data.table)
places <- athena_execute_fetch('SELECT * from places.places where ds = (select max(ds) from places.places) limit 5')
places$ds <- NULL
input_places <- places %>% select(area_id, everything())
dailyNormalizationCoefficients(input_places, as.Date('2020-01-20),as.Date('2020-01-20), id_column_name = 'area_id')
fwrite(input_places,'input_places.csv')
fwrite(poi_normalization_coefficient_wide, 'poi_normalization_coefficient_wide.csv')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.