Skip to content

Commit

Permalink
Fix which package fips data is being loaded from
Browse files Browse the repository at this point in the history
  • Loading branch information
pdil committed Dec 11, 2023
1 parent 0c8cb82 commit 29c4a6c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions R/fips-data.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ fips_data <- function(regions = c("states", "state", "counties", "county")) {

if (regions_ == "state" || regions_ == "states")
utils::read.csv(
system.file("extdata", "state_fips.csv", package = "usmap"),
system.file("extdata", "state_fips.csv", package = "usmapdata"),
colClasses = rep("character", 3), stringsAsFactors = FALSE
)
else if (regions_ == "county" || regions_ == "counties")
utils::read.csv(
system.file("extdata", "county_fips.csv", package = "usmap"),
system.file("extdata", "county_fips.csv", package = "usmapdata"),
colClasses = rep("character", 4), stringsAsFactors = FALSE
)
}
10 changes: 5 additions & 5 deletions tests/testthat/test-fips-data.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ test_that("county FIPS codes load correctly", {
expect_identical(county_fips, counties_fips)

expect_equal(length(county_fips), 4)
expect_equal(length(county_fips[, 1]), 3235)
expect_equal(length(county_fips[, 1]), 3236)

expect_equal(county_fips[1, "full"], "Alaska")
expect_equal(county_fips[1, "abbr"], "AK")
expect_equal(county_fips[1, "county"], "Aleutians West Census Area")
expect_equal(county_fips[1, "fips"], "02016")

expect_equal(county_fips[3235, "full"], "Wyoming")
expect_equal(county_fips[3235, "abbr"], "WY")
expect_equal(county_fips[3235, "county"], "Washakie County")
expect_equal(county_fips[3235, "fips"], "56043")
expect_equal(county_fips[3236, "full"], "Wyoming")
expect_equal(county_fips[3236, "abbr"], "WY")
expect_equal(county_fips[3236, "county"], "Washakie County")
expect_equal(county_fips[3236, "fips"], "56043")
})

0 comments on commit 29c4a6c

Please sign in to comment.