-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
Feature suggestion: Extending lookup_code()
to return just FIPS codes (with no message)
#136
Comments
yeah I like this idea! |
That makes sense! It occurs to me that returning a data frame could also allow the lookup function work a bit more broadly where the state parameter is required (supporting state name, abbreviation, or FIPS number as character or numeric) and county is optional (as name or FIPS number) but the function always returns a dataframe with columns for everything (state name, state abbreviation, state FIPS and, if county is provided, county name and county FIPS). This could make it work for translating a FIPS into an abbreviation as well as the other way around. Does that make sense? Happy to put together a pull request with a first draft if that is helpful. I noticed the old TODO for eliminating the dependence on the fips_state_table so I could try to tackle that at the same time. |
@elipousson I'm happy to go the direction you find most useful here; one limitation about returning a data frame is that users can already just grab the |
I think I came up with an approach that works pretty well. It maintains the existing functionality but adds the option to set One small question: I used vapply to get validate_county and validate_state to support multiple states or a state and multiple counties but did not set |
No real rush, @walkerke but I just wanted to ping you in case this got lost in the shuffle. Let me know if I should should go ahead and make a pull request for your review or if you'd suggest a different approach! |
Also fix issue w/ how validate_county would warn in case of invalid inputs Also fix typo (used error_call instead of caller_env) and add `check_tigris_arg()` helper function
I'm developing a package to access a federal agency API that uses integer versions of FIPS codes for state and county identifiers. I found the
lookup_code()
function but it didn't really do what I needed so I ended up importing thevalidate_state()
andvalidate_county()
functions into my own package in order to make this work.I am curious if you'd be interested in a pull request to extend the existing
lookup_code()
function that makes it optionally return just FIPS codes and/or exporting the usefulvalidate_state()
andvalidate_county()
functions. I included my ownlookup_fips()
function below for consideration of some possible options. I'm sure this isn't a widespread use case but figured there is no harm in asking.The text was updated successfully, but these errors were encountered: