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

nhd_get not recognizing Alaska #90

Closed
hrecht opened this issue Feb 1, 2023 · 4 comments
Closed

nhd_get not recognizing Alaska #90

hrecht opened this issue Feb 1, 2023 · 4 comments

Comments

@hrecht
Copy link

hrecht commented Feb 1, 2023

Hi, thanks for the great package. I'm trying to get data for Alaska and am getting this error message:

> nhd_get(state = "AK")
Error in FUN(X[[i]], ...) : AK is not a valid state abbreviation

It looks like the issue stems from this line of code. I'm not familiar with the maps library but it seems to not have Alaska in it.
https://github.com/jsta/nhdR/blob/master/R/get.R#L19

One solution would be to switch to R's built in state.abb dataset plus DC and the territories.

@jsta
Copy link
Owner

jsta commented Feb 1, 2023

Thanks for the heads-up. My preference would be to add "AK" to the subsequent line (L20) of that file. Getting automated package checking to recognize built-in datasets can be a real pain in my experience.

@hrecht
Copy link
Author

hrecht commented Feb 1, 2023

I feel that pain! It looks like it is working here though?
https://github.com/jsta/nhdR/blob/master/R/utils.R#L289
Another option would be to add your own simple dataset of the postal abbreviations and state names, and that could include territories as well. I do something similar for state fips codes in my censusapi package.

Some other U.S. territories that seem to not be recognized but do have NHD state files: American Samoa, Guam, Northern Mariana Islands.

@jsta
Copy link
Owner

jsta commented Feb 1, 2023

Awesome1 Let's go with your initial suggestion then.

Relevant state/territory code key:
https://en.wikipedia.org/wiki/List_of_U.S._state_and_territory_abbreviations

@jsta jsta closed this as completed in 8115ef8 Feb 1, 2023
@hrecht
Copy link
Author

hrecht commented Feb 2, 2023

This is working now, thanks for such a quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants