From 5d927966f5f47c63480845438b13c8263580e288 Mon Sep 17 00:00:00 2001 From: Paolo Di Lorenzo Date: Thu, 1 Oct 2020 17:55:40 -0400 Subject: [PATCH] Fix duplicate row removal on usmap_transform, fixes #32 --- NEWS.md | 1 + R/transform.R | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index c191bae..f19516d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -3,6 +3,7 @@ * Lightweight landing page containing useful information, links, and examples of usmap usage. * `state` can now be omitted when using `fips()`. In this case, all available FIPS codes are returned, sorted by state abbreviation, see [Issue #28](https://github.com/pdil/usmap/issues/28). * `fips` can now be omitted when using `fips_info()`. In this case, all available states are returned, sorted by state abbreviation, see [Issue #28](https://github.com/pdil/usmap/issues/28). +* Fix duplicate coordinates from being removed during `usmap_transform` (if value columns differ), see [Issue #32](https://github.com/pdil/usmap/issues/32). * Prevent [warnings introduced by `ggplot2` v3.3.0](https://github.com/tidyverse/ggplot2/pull/3346), see [Issue #35](https://github.com/pdil/usmap/issues/35). # usmap 0.5.0 diff --git a/R/transform.R b/R/transform.R index bb376b4..2a2df8f 100644 --- a/R/transform.R +++ b/R/transform.R @@ -156,7 +156,7 @@ usmap_transform.data.frame <- function(data) { } result <- as.data.frame( - combined[!duplicated(combined@data[, c(1, 2)], fromLast = TRUE), ] + combined[!duplicated(combined@data, fromLast = TRUE), ] ) row.names(result) <- NULL