-
Notifications
You must be signed in to change notification settings - Fork 2
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
rbind_results()
helper function
#42
Conversation
Taking a quick look now, looks good to me. Moving this into
I think the inherits_or_null call should handle this but it did take some figuring out how to make sure this worked with tables, feature layers, and layers when returnGeometry was set to FALSE. There are also endpoints that return KML, XML, or other data types which this function would presumably not be able to handle. |
Thank you very much for your feedback! I've modified the I've fixed the documentation to reference |
This PR adds a new function that takes a list of data.frames or sf objects and combines them as efficiently as possible.
Closes #38
Related R-ArcGIS/arcgislayers#167
This helps us with the pattern described in #38. There are two points I want to make. One of the annoying bits of the Esri REST API endpoints is that errors are not returned as a status code, but rather, the error is captured in the json body.
Avoiding
httr2::resps_data()
httr2::resps_data()
is a useful function, however, it usesvctrs::list_unchop()
which is only marginally faster thando.call(rbind.data.frame, list())
whereascollapse::rowbind()
is orders of magnitude faster. The approach introduced in #42 will use collapse, data.table, vctrs, then base R to ensure the fastest approach is used. These are incompatible withhttr2::resps_data()
.Errors are not captured 400 codes
One challenging part of the ArcGIS location service endpoints is that errors are not returned as a 400 code. Instead, they are a json response with the error as plain text json.
The approach that I think might be most streamlined is this:
rbind_results()
helper function #42)NULL
responses to add error information to the response as an attribute. How do we do this?This approach can be wrapped in another utility function similar to
resps_data()
something likearc_resps_data()
which would have a signature like so:The attribute
null_elements
returns the indices of the errors. Then each function can either return the requests / response or...something?@elipousson, would you mind reviewing if you have time?