-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pmap (almost) all the things #67
Conversation
…for urls with stuff like 'c(\"abbrv=1\", \"abbrv=0\")'
…dence, no_annotations, abbrv, etc.
|
||
results <- tidyr::unnest(results_nest, op) # nolint | ||
# `op` is necessary, so that other list columns are not unnested | ||
# but lintr complains about `op` not being defined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah interesting and tidyr has no such thing like dplyr's .data$
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, or rather op
is part of ...
?! I don't remember though if lintr would be satisfied with op
being defined in globalVariables
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic work @dpprdan, thanks a ton! I have added comments/requests but they're all minimal I think.
Two further comments
❯ checking R code for possible problems ... NOTE
oc_forward_df: no visible binding for global variable ‘query’
oc_forward_df: no visible binding for global variable ‘lat’
oc_forward_df: no visible binding for global variable ‘lng’
oc_forward_df: no visible binding for global variable ‘formatted’
oc_forward_df: no visible binding for global variable ‘op’
oc_reverse_df: no visible binding for global variable ‘query’
oc_reverse_df: no visible binding for global variable ‘formatted’
oc_reverse_df: no visible binding for global variable ‘op’
Undefined global functions or variables:
formatted lat lng op query
So lintr
isn't the only one to complain 😉
❯ checking Rd cross-references ... NOTE
Package unavailable to check Rd xrefs: ‘sf’
Please remove the cross-ref to sf
because otherwise we'd need to have sf
as a dependency.
Co-Authored-By: dpprdan <possenriede@gmail.com>
Co-Authored-By: dpprdan <possenriede@gmail.com>
Co-Authored-By: dpprdan <possenriede@gmail.com>
Re global variables: That is fixed in devel already. Do I need to do anything here? Re |
The cross ref is from somewhere in docs where you tried to refer to sf docs, we should not do that since sf is not a dependency. But yes to making that example safer too! |
The main point of the feat_pmap branch is to vectorise (almost) all arguments of
oc_forward()
/oc_reverse()
. This made some code clean_up necessary. The exported gecoding functions basically just wrapoc_check_query
andoc_process()
which do the main work.The main changes are:
oc_forward_df()
/oc_reverse_df()
. This is probably the part I am most uncertain about, so let me know if you have a better idea on how to implement this.oc_bbox()
helper function, to get the countrycode arguments into shape.oc_config()
function, which only changes the rate limit at the moment (useful if you have one of the paid plans), but may also change other per-session settings in the future.return = "url_only"
is only allowed ifkey = NULL
or if used in an interactive session in order to prevent credential leakage.I'll also add the current NEWS:
opencage 0.1.4.9001
This is a major rewrite of the {opencage} package.
opencage_forward()
andopencage_reverse()
have been deprecated and are superseded byoc_forward()
andoc_reverse()
, respectively. In addition there are two new functionsoc_forward_df()
andoc_reverse_df()
, which (reverse) geocode aplacename
column (orlatitude
/longitude
columns) in a data frame.The new features include:
oc_forward()
andoc_reverse()
return either lists of data frames, JSON strings, GeoJSON strings, or URLs to be sent to the API (for debugging purposes).oc_forward_df()
andoc_reverse_df()
take a data frame as input and return a data frame with the geocoding results, optionally with the source data frame bound to the results data frame.output
,key
andno_record
), so it is possible to serially (reverse) geocode lists of placenames or coordinates. The geocoding functions show a progress indicator when more than oneplacename
orlatitude
/longitude
pair is provided.countrycode
s in accordance with the OpenCage API (Support multiple country codes #44). Thecountrycode
s can now be provided in upper or lower case (Let country code be lower or upper #47).oc_bbox()
now makes it easier to create (lists of) bounding boxes from vectors, bbox objects and data frames.oc_config()
.Breaking changes
opencage_forward()
,opencage_reverse()
, andopencage_key()
are (soft) deprecated.opencage_key()
has just been renamed tooc_key()
for consistency.opencage_forward()
andopencage_reverse()
will always output strings as characters, i.e. they won't coerce to factor depending on thestringsAsFactor
option.languagecodes
andcountrycodes
is nowcode
, and notalpha2
andCode
, respectively.