A function to parse the location strings in the Ad Targeting Dataset and split into separate columns for each level of detail.
Arguments
- .x
A data.frame containing the location string
- loc_var
A character string specifying the name of the column in .x that contains the location string
- type
A character string specifying the prefix to add to each column of split location details. Default is "include". Should be "include" or "exclude".
- verbose
A logical flag specifying whether to display a progress bar during processing. Default is
TRUE
.
Examples
if (FALSE) { # \dontrun{
### create a dataset with unique include_location values
distinct_data <- targeting_data %>%
distinct(include_location)
#### parse the location data and join in original dataset
distinct_data %>%
parse_location(include_location, type = "include") %>%
right_join(targeting_data)
###----####
### create a dataset with unique exclude_location values
distinct_data <- targeting_data %>%
distinct(exclude_location)
#### parse the location data and join in original dataset
distinct_data %>%
parse_location(exclude_location, type = "exclude") %>%
right_join(targeting_data)
} # }