You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The object returned by us_counties() has two columns named state_name, which causes problems for functions that require unique names. make.names(unique = TRUE) makes all of the names unique.
Reprex:
usCounties<-USAboundaries::us_counties()
dplyr::left_join(usCounties, usCounties)
#> Error in `dplyr::left_join()`:#> ! Input columns in `x` must be unique.#> ✖ Problem with `state_name`.usCountiesNames<- names(usCounties) |> make.names(unique=TRUE)
usCountiesUniqueNames<-purrr::set_names(usCounties, usCountiesNames)
dplyr::left_join(usCountiesUniqueNames, usCountiesUniqueNames)
#> Joining, by = c("statefp", "countyfp", "countyns", "affgeoid", "geoid", "name",#> "namelsad", "stusps", "state_name", "lsad", "aland", "awater", "state_name.1",#> "state_abbr", "jurisdiction_type", "geometry")#> Error:#> ! All columns in a tibble must be vectors.#> ✖ Column `geometry` is a `sfc_MULTIPOLYGON/sfc` object.#> #> Note that this second error is different and can only occur because the error with non-unique column names has been resolved.
The object returned by
us_counties()
has two columns namedstate_name
, which causes problems for functions that require unique names.make.names(unique = TRUE)
makes all of the names unique.Reprex:
Created on 2022-07-28 by the reprex package (v2.0.1)
The text was updated successfully, but these errors were encountered: