简体   繁体   中英

What is the format for state names in Choroplethr?

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"

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 = "") 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM