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

fips should be vectorized for counties #10

Closed
pdil opened this issue Jul 12, 2018 · 0 comments
Closed

fips should be vectorized for counties #10

pdil opened this issue Jul 12, 2018 · 0 comments
Assignees
Labels
enhancement A suggestion or feature that improves existing functionality

Comments

@pdil
Copy link
Owner

pdil commented Jul 12, 2018

Actual Behavior

Currently, the following does not work:

fips("NJ", county = c("Bergen", "Hudson"))

As it outputs the following:

#> [1] "34003"
#> Warning messages:
#> 1: In if (county_ == "") { :
#>   the condition has length > 1 and only the first element will be used
#> 2: In name == county_ :
#>   longer object length is not a multiple of shorter object length
#> 3: In name == paste(county_, "county") :
#>   longer object length is not a multiple of shorter object length

It just results in the FIPS code of the first county entered in the vector, followed by a warning.

Expected Behavior

fips("NJ", county = c("Bergen", "Hudson"))
#> [1] "34003" "34017"

This would allow the ability to quickly convert a column of county names to a FIPS code in a data frame.

Things to Consider

  • How to handle multiple states and multiple counties at the same time?
    For example:
fips(state = c("NJ", "NY"), county = c("Bergen", "Hudson", "Westchester")

This would not work unless there was a direct mapping between the state and county parameters. In this case it would be easier to throw an error.

@pdil pdil added the enhancement A suggestion or feature that improves existing functionality label Jul 12, 2018
@pdil pdil self-assigned this Jul 12, 2018
@pdil pdil closed this as completed in e589222 Sep 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A suggestion or feature that improves existing functionality
Projects
None yet
Development

No branches or pull requests

1 participant