0

keep getting this error, not sure what I am doing incorrectly, tried using fill=factor() but that didn't work either, any help is greatly appreciated.

Storing data

map <- map_data("state")
map

Creating map

map.simple  <- ggplot() +   geom_map(data=map,aes(x=map$long,y=map$lat,map_id=region),map=map,fill="white", color="black")  
map.simple

Creating map with average income in each state

map.income  <- map.simple + geom_map(data=Final.income, map=map,aes(fill=as.factor(avgmedian),map_id=State),color="black",na.rm=TRUE)
map.income
Gaurav Jeswani
  • 4,410
  • 6
  • 26
  • 47
  • [Don't use `$` inside `aes`](https://stackoverflow.com/questions/32543340/issue-when-passing-variable-with-dollar-sign-notation-to-aes-in-combinatio) – camille Nov 25 '19 at 04:29
  • I took them out and am still getting the same error – Calvin Kenyon Nov 25 '19 at 04:36
  • @CalvinKenyon, can you edit your question to provide the output of `head(Final.income)` and `str(Final.income)` and also provide a small [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) ? – dc37 Nov 25 '19 at 05:15

0 Answers0