I have some dataset df
with the variables state
and status
. I wanted a table that gave me the frequency by both state and status, so I used table(df$State, df$Status)
, and everything worked fine. Now, I want to make a US map using plot_usmap
but I need a column with the two letter names of each state, which is in my table, but it is not a column, it is just the "index" although with strings instead of numbers. How do I take this not-a-column (I don't know what's the correct term for this part of the table), and turn it into a column I can use.
Table gave me the frequency data per state per status (the possible statuses are CHGOFF and P I F). I added the Total
column manually. I need the column that has the names of the states.