1 year ago

#367193

test-img

PythonG

Mapping Amount of Executions per State in R

I am currently working on a project regarding the amount of executions happening in each U.S. state. I am working with the dataset from :https://deathpenaltyinfo.org/executions/execution-database. I used the usmap package from R to generate a map accordingly to my project. I found a guide on how to map U.S. states properly via Cran Project.

`plot_usmap(data = statepop, values = "pop_2015"., color = "red") + 
  scale_fill_continuous(name = "Executions ", label = scales::comma) + 
  theme(legend.position = "right")`

Is there a way to implement the execution amounts on my dataset on the usmap?

I tried something like this:

data = execdat %>% group_by(State) %>% summarise(Executions = n())
plot_usmap(data = data, values = data$Executions., color = "red") + 
  scale_fill_continuous(name = "Executions ", label = scales::comma) + 
  theme(legend.position = "right")

But I get an error code:

Error in map_with_data(data, values = values, include = include, exclude = exclude) : 
  "c("Alabama", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "Federal", "Florida", "Georgia", "Idaho", "Illinois", "Indiana", "Kentucky", "Louisiana", "Maryland", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Mexico", "North Carolina", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Virginia", "Washington", "Wyoming")" column not found in `data`."c(69, 37, 31, 13, 1, 1, 16, 16, 99, 76, 3, 12, 20, 3, 28, 5, 22, 91, 3, 4, 12, 1, 43, 56, 116, 2, 3, 43, 5, 13, 573, 7, 113, 5, 1)" column not found in `data`.
In addition: Warning message:
In if (!(values %in% names(data))) { :
  the condition has length > 1 and only the first element will be used

I want to have something like this: from reddit.com/MapPorn

r

ggplot2

dataset

usmap

0 Answers

Your Answer

Accepted video resources