Skip to content
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

Appropriately handle lat and long columns and add flexibility #63

Open
njtierney opened this issue Jul 19, 2018 · 3 comments
Open

Appropriately handle lat and long columns and add flexibility #63

njtierney opened this issue Jul 19, 2018 · 3 comments
Milestone

Comments

@njtierney
Copy link
Owner

At the moment maxcovr assumes that all columns with latitude and longitude information are named lat and long.

This is not ideal, as it throws a cryptic error message when these are not given the appropriate names.

There should be three steps in refactoring:

  1. Add a stop function that stops the analysis if things are not named lat and long. This can then be used in each function that uses that info.

  2. Allow the user to specify their own lat and long arguments

  3. Cleverly detect different variations on lat and long as leaflet does and display a nice message

@njtierney njtierney added this to the 0.4.0 milestone Jul 19, 2018
@mpadge
Copy link
Contributor

mpadge commented Jun 5, 2019

I've got this kind of thing in dodgr with an internal dodgr_graph_cols function, which relies on a whole bunch of helper functions here. It's kinda messy, but works really well at auto-identifying standard columns based on unknown and variable input names. The idea is to return a list so everything else then works like this:

cols <- dodgr_graph_cols (graph)
lon <- my_input [[cols$lon]]

... or whatever. Point is, it's robust and flexible: Write a function to auto-identify the columns you need; return those as list items; then use code like the above to extract when needed.

@njtierney
Copy link
Owner Author

OK that is rather neat!

Am I correct in that we are looking for something like this to identify say x and y cols:

@mpadge
Copy link
Contributor

mpadge commented Jun 5, 2019

yeah, the details are all pretty easy. The difficult and important thing was figuring out that the get_columns function should return a list. From that point on, it's all easy

@njtierney njtierney modified the milestones: 0.4.0, 0.3.0 Nov 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants