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 codes load as numeric, not character #6

Open
dhmontgomery opened this issue Feb 6, 2018 · 1 comment
Open

FIPS codes load as numeric, not character #6

dhmontgomery opened this issue Feb 6, 2018 · 1 comment
Assignees

Comments

@dhmontgomery
Copy link

When calling data(USA_county_data), the fips column imports as numeric, which obviously causes problem for the 317 counties where the FIPS begins with a 0.

This is easily rectifiable (I ran for (i in 1:nrow(USA_county_data)) {if(nchar(USA_county_data$fips[i]) == 4) {USA_county_data$fips[i] <- paste0("0", USA_county_data$fips[i])}}) but it seems like the data should ideally come in leading-zero-preserving character format to begin with.

@Deleetdk
Copy link
Owner

Deleetdk commented Feb 8, 2018

Some sources use integers (thus no leading 0's), others use characters (i.e. preserve leading 0's). However, this does not cause any actual ambiguity because there are no pairs like {00123, 123}. One can easily add them back using stringr::str_pad().

I'll take a look when I get back from work.

@Deleetdk Deleetdk self-assigned this Feb 8, 2018
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