0

I want to make a map of the U.S using ggplot and mark states by the data.

this is the link for my DB I tried this

map_data <- prop.table(table(data_benefits$state))
  plot_usmap(data = map_data, values = "benefits", color = "red") +
    scale_fill_continuous(name = "Benefits", label = scales::comma) +
    theme(legend.position = "right")

but I didn't worked at all , I'm trying to paint the states in us by the states col in thr csv file I be glud if someone can help me thanks

  • 2
    Hi Michal_Elbaz. Could you specify *what* did not work? What errors are you getting? Also, its always easier for others if you add [minimal reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/5963610#5963610) so we don't have to download data from external websites... – dario Mar 08 '20 at 09:14
  • Hi Michael, welcome to SO ! based on your csv file, your states are designed by ID, but how do you which ID is corresponding to which states. Is it alphabetical order ? Because `plot_usmap` uses states names (or abbreviations) in its own dataset. – dc37 Mar 08 '20 at 09:17
  • Hi @dc37 "state" means- state of residence code https://app.quadstat.net/dataset/r-dataset-package-ecdat-benefits – Michal_Elbaz Mar 08 '20 at 12:06

0 Answers0