I am looking to shade specific counties on map.
just to begin working on this, I took this base code here ( suggested in several posts with no error mentioned ) .for example :[https://stackoverflow.com/questions/33129917/shading-counties-using-fips-code-in-r-map
library(maps)
library(dplyr)
data(county.fips)
## Set up fake df_pop_county data frame
df_pop_county <- data.frame(region=county.fips$fips)
df_pop_county$value <- county.fips$fips
y <- df_pop_county$value
df_pop_county$color <- gray(y / max(y))
## merge population data with county.fips to make sure color column is
## ordered correctly.
counties <- county.fips %>% left_join(df_pop_county, by=c('fips'='region'))
map("county", fill=TRUE, col=counties$color)
but when I run this ( or even similar map() related codes ) I get : Error in numeric(nrowz) : invalid 'length' argument in map() r
I appreciate any suggestion how to resolve this error.