What is the format for state names in Choroplethr?

90 Views Asked by At

I'm trying to create a Choropleth of a county using tracts as units.

Where it says "state_name", I have no idea what to put.

I've tried OH, OHIO, and the FIPS codes.

tract_choropleth(df, ohio, title = "census", legend = "",)

Each result ends with "Error in state_name %in% state.regions$region : object 'ohio' not found"

1

There are 1 best solutions below

0
On

The format for the names is a lower-case string. But it must be a string. The sample code has the unquoted ohio, so R is trying to interpret it as a variable name. Just quoting the string will make it work.

tract_choropleth(df, "ohio", title = "census", legend = "")