Skip to content

Commit

Permalink
fix st_cast to polygon code
Browse files Browse the repository at this point in the history
  • Loading branch information
mpadge committed Feb 28, 2024
1 parent f7baa26 commit 9dd1419
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: ushardship
Title: Hardship Index from United States Census Data
Version: 0.0.1.027
Version: 0.0.1.028
Authors@R:
person(given = "Mark",
family = "Padgham",
Expand Down
7 changes: 6 additions & 1 deletion R/hardship-index.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ hs_hardship_index <- function (state = "AZ", year = 2022, survey = "acs5") {
dat <- dat [index, ]

# Cast to polygons:
dat$geometry <- sf::st_cast (dat$geometry, "POLYGON")
dat <- sf::st_as_sf (dat)
dat <- sf::st_cast (dat, "POLYGON")
index <- which (duplicated (dat$GEOID))
if (length (index) > 0L) {
dat <- dat [-index, ]
}

# replace any NA values with weighted neighbour values:
cli::cli_alert_info (cli::col_yellow ("Imputing missing values ..."))
Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"codeRepository": "https://github.com/UrbanAnalyst/us-hardship-index",
"issueTracker": "https://github.com/UrbanAnalyst/us-hardship-index/issues",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "0.0.1.027",
"version": "0.0.1.028",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down

0 comments on commit 9dd1419

Please sign in to comment.