create_sql_visits_query: Creates a query that returns the visits in each polygon

Description Usage Arguments Value Examples

View source: R/geo_utilities.R

Description

Returns visits and dwell time in each polygon. Note that the name of the IDFA column must be 'aid'

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
create_sql_visits_query(
  places_table_name,
  ds_from,
  ds_to,
  location_table_name = "emr.dataset_accumulo",
  places_id_column_name = "id",
  places_wkt_column_name = "wkt",
  destination_table = NULL,
  places_options = "",
  aid_options = ""
)

Arguments

places_table_name

the table with the polygons

ds_from

the day date for which we are retrieving the visits (for 1 day can be the same as ds_to)

ds_to

the day date for which we are retrieving the visits (for 1 day can be the same as ds_from)

location_table_name

the table that stores the ping (defaults emr.dataset_accumulo) (hardcoded columns lon, lat)

places_id_column_name

the name of the column containing the ID of the place (defaults to id)

places_wkt_column_name

the column containing the polygon in WKT format (defaults to wkt)

destination_table

a destination table for the INSERT, leave default NULL if you want to fetch the rows

places_options

can be a clause like WHERE places.bt_level4 = 'Q8'

aid_options

can be a clause like 'AND aid in = (SELECT aid from test.audience_table)'. Should contain AND because it's placed after the select

Value

the SQL query for the visits

Examples

1
create_sql_visits_query("R.mcdonalds_eevm_places", '2019-10-04', '2019-10-27')

alesaccoia/alexr documentation built on Dec. 19, 2021, 12:26 a.m.