Description Usage Arguments Details Value Examples
View source: R/address_cleaner.R
Performs character transformations on a vector of addresses in order to build "web-safe" URLs for the Google API.
1 | address_cleaner(address, verbose = TRUE)
|
address |
A raw 1xN vector of UTF-8 encoded addresses. Note: these addresses should be in raw form, not URL encoded (e.g., of the form: 123 Main Street, Somewhere, NY 12345 USA)(country is optional but recommended). |
verbose |
Displays additional progress output |
This function scrubs a vector of addresses (e.g., a vector of the form: address, city, state, postal code, country) of character values that may inhibit sucessful geocoding with the Google maps API. Specifically, address_cleaner:
Replaces non-breaking spaces with " "
Removes ASCII control characters (001-031 and 177)
Trims runs of spaces and spaces which begin/end a string
Converts special addressing charecters, such as ordinals
Strips latin1 characters
Removes leading, trailing, and repeated commas
Remove various permutations of the "c/o" flag
Note: We recommend reviewing the output of this function against the original vector to ensure the transformations it performs resolve the formatting issues (if any) found in your source data.
address_cleaner returns a character vector of addresses of the same length as the input.
1 2 3 4 5 6 | # Clean an incompatible vector of addresses
address <- c(" 1600 Pennsylvania Ave NW <c2><bd>, Washington, DC 20500, USA ",
" <c2><aa>1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA")
# View the return:
address_cleaner(address)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.