GeoDataRead: Data reading function for GeoLift.

View source: R/pre_processing_data.R

GeoDataReadR Documentation

Data reading function for GeoLift.

Description

[Stable]

GeoDataRead reads a data-frame and processes it for GeoLift. The function will clean the data, generate a time variable that increases by 1 for each time period (day/week/month), and aggregate the data by time and location. It is important to have data for each location and time-period and avoid special characters in the names of the geographical units.

Usage

GeoDataRead(
  data,
  date_id = "date",
  location_id = "location",
  Y_id = "units",
  format = "mm/dd/yyyy",
  X = c(),
  summary = FALSE,
  keep_unix_time = FALSE
)

Arguments

data

A data.frame containing the historical conversions by geographic unit. It requires a "locations" column with the geo name, a "Y" column with the outcome data (units), a time column with the date, and covariates. Valid date formats are: "mm/dd/yyyy", "mm-dd-yyyy", "mm.dd.yyyy", "mmddyyyy", "dd/mm/yyyy", "dd-mm-yyyy", "dd.mm.yyyy", "ddmmyyyy", "yyyy/mm/dd", "yyyy-mm-dd", "yyyy.mm.dd", "yyyymmdd", "ww/yyyy", "ww-yyyy", "ww.yyyy", "wwyyyy", "yyyy/ww", "yyyy-ww", "yyyy.ww", "yyyyww", "mm/yyyy", "mm-yyyy", "mm.yyyy", "mmyyyy", "yyyy/mm", "yyyy-mm", "yyyy.mm", "yyyymm"

date_id

Name of the date variable (String).

location_id

Name of the location variable (String).

Y_id

Name of the outcome variable (String).

format

Format of the dates in the data frame.

X

Vector with covariates names.

summary

Display a summary of the data-reading process. FALSE by default.

keep_unix_time

A logic flag indicating whether to keep a column with each event's unix time.

Value

A data frame for GeoLift inference and power calculations.


facebookincubator/GeoLift documentation built on May 31, 2024, 10:09 a.m.