Skip to content

Commit

Permalink
Merge pull request #154 from dpprdan/fix/memoise
Browse files Browse the repository at this point in the history
fix memoise
  • Loading branch information
jessecambon authored Oct 30, 2021
2 parents eaea634 + 186655f commit feb86d4
Show file tree
Hide file tree
Showing 10 changed files with 118 additions and 36 deletions.
51 changes: 39 additions & 12 deletions R/geo.R
Original file line number Diff line number Diff line change
Expand Up @@ -147,18 +147,45 @@ progress_geo <- function(pb = NULL, ...) {
#' }
#' @seealso [geocode] [api_parameter_reference] [min_time_reference] [batch_limit_reference]
#' @export
geo <- function(address = NULL,
street = NULL, city = NULL, county = NULL, state = NULL, postalcode = NULL, country = NULL,
method = 'osm', cascade_order = c('census', 'osm'), lat = lat, long = long, limit = 1,
full_results = FALSE, mode = '', unique_only = FALSE, return_addresses = TRUE,
min_time = NULL, progress_bar = show_progress_bar(), quiet = getOption("tidygeocoder.quiet", FALSE),
api_url = NULL, timeout = 20, flatten = TRUE, batch_limit = NULL, batch_limit_error = TRUE,
verbose = getOption("tidygeocoder.verbose", FALSE), no_query = FALSE,
custom_query = list(), api_options = list(),
return_type = 'locations', iq_region = 'us', geocodio_v = 1.6,
param_error = TRUE, mapbox_permanent = FALSE, here_request_id = NULL,
mapquest_open = FALSE) {

geo <-
function(
address = NULL,
street = NULL,
city = NULL,
county = NULL,
state = NULL,
postalcode = NULL,
country = NULL,
method = 'osm',
cascade_order = c('census', 'osm'),
lat = 'lat',
long = 'long',
limit = 1,
full_results = FALSE,
mode = '',
unique_only = FALSE,
return_addresses = TRUE,
min_time = NULL,
progress_bar = show_progress_bar(),
quiet = getOption("tidygeocoder.quiet", FALSE),
api_url = NULL,
timeout = 20,
flatten = TRUE,
batch_limit = NULL,
batch_limit_error = TRUE,
verbose = getOption("tidygeocoder.verbose", FALSE),
no_query = FALSE,
custom_query = list(),
api_options = list(),
return_type = 'locations',
iq_region = 'us',
geocodio_v = 1.6,
param_error = TRUE,
mapbox_permanent = FALSE,
here_request_id = NULL,
mapquest_open = FALSE
) {

# NSE - Quote unquoted vars without double quoting quoted vars
# end result - all of these variables become character values
lat <- rm_quote(deparse(substitute(lat)))
Expand Down
21 changes: 18 additions & 3 deletions R/geocode.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,24 @@
#' }
#' @seealso [geo]
#' @export
geocode <- function(.tbl, address = NULL, street = NULL, city = NULL, county = NULL,
state = NULL, postalcode = NULL, country = NULL,
lat = lat, long = long, return_input = TRUE, limit = 1, return_addresses = NULL, unique_only = FALSE, ...) {
geocode <-
function(
.tbl,
address = NULL,
street = NULL,
city = NULL,
county = NULL,
state = NULL,
postalcode = NULL,
country = NULL,
lat = 'lat',
long = 'long',
return_input = TRUE,
limit = 1,
return_addresses = NULL,
unique_only = FALSE,
...
) {

# Non-standard evaluation --------------------------------------------------------------
# Quote unquoted vars without double quoting quoted vars
Expand Down
14 changes: 11 additions & 3 deletions R/geocode_combine.R
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,17 @@ geo_combine <- function(queries, global_params = list(), address = NULL,
#' }
#' @seealso [geo_combine] [geo] [geocode]
#' @export
geocode_combine <- function(.tbl, queries, global_params = list(),
return_list = FALSE, cascade = TRUE, query_names = NULL,
lat = lat, long = long) {
geocode_combine <-
function(
.tbl,
queries,
global_params = list(),
return_list = FALSE,
cascade = TRUE,
query_names = NULL,
lat = 'lat',
long = 'long'
) {

# NSE - converts lat and long parameters to character values
lat <- rm_quote(deparse(substitute(lat)))
Expand Down
37 changes: 29 additions & 8 deletions R/reverse_geo.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,35 @@ get_coord_parameters <- function(custom_query, method, lat, long) {
#' }
#' @seealso [reverse_geocode] [api_parameter_reference] [min_time_reference] [batch_limit_reference]
#' @export
reverse_geo <- function(lat, long, method = 'osm', address = address, limit = 1,
full_results = FALSE, mode = '', unique_only = FALSE, return_coords = TRUE,
min_time = NULL, progress_bar = show_progress_bar(), quiet = getOption("tidygeocoder.quiet", FALSE),
api_url = NULL, timeout = 20, flatten = TRUE,
batch_limit = NULL, verbose = getOption("tidygeocoder.verbose", FALSE),
no_query = FALSE, custom_query = list(), api_options = list(), iq_region = 'us', geocodio_v = 1.6,
mapbox_permanent = FALSE, here_request_id = NULL, mapquest_open = FALSE) {

reverse_geo <-
function(
lat,
long,
method = 'osm',
address = 'address',
limit = 1,
full_results = FALSE,
mode = '',
unique_only = FALSE,
return_coords = TRUE,
min_time = NULL,
progress_bar = show_progress_bar(),
quiet = getOption("tidygeocoder.quiet", FALSE),
api_url = NULL,
timeout = 20,
flatten = TRUE,
batch_limit = NULL,
verbose = getOption("tidygeocoder.verbose", FALSE),
no_query = FALSE,
custom_query = list(),
api_options = list(),
iq_region = 'us',
geocodio_v = 1.6,
mapbox_permanent = FALSE,
here_request_id = NULL,
mapquest_open = FALSE
) {

# NSE eval
address <- rm_quote(deparse(substitute(address)))

Expand Down
15 changes: 13 additions & 2 deletions R/reverse_geocode.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,19 @@
#' }
#' @seealso [reverse_geo]
#' @export
reverse_geocode <- function(.tbl, lat, long, address = address, return_input = TRUE, limit = 1, return_coords = NULL, unique_only = FALSE, ...) {

reverse_geocode <-
function(
.tbl,
lat,
long,
address = 'address',
return_input = TRUE,
limit = 1,
return_coords = NULL,
unique_only = FALSE,
...
) {

# Non-standard evaluation --------------------------------------------------------------
# Quote unquoted vars without double quoting quoted vars
# end result - all of these variables become character values
Expand Down
4 changes: 2 additions & 2 deletions man/geo.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/geocode.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/geocode_combine.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/reverse_geo.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/reverse_geocode.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit feb86d4

Please sign in to comment.