【问题标题】:What is the format for state names in Choroplethr?Choroplethr 中州名的格式是什么?
【发布时间】:2019-03-26 20:53:30
【问题描述】:

我正在尝试使用区域作为单位创建一个县的 Choropleth。

上面写着“state_name”,我不知道该放什么。

我已经尝试过 OH、OHIO 和 FIPS 代码。

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

每个结果都以“state_name %in% state.regions$region 中的错误:找不到对象‘ohio’”结尾

【问题讨论】:

  • 全部小写,但需要引号tract_choropleth(df, "ohio", title = "census", legend = "")
  • 解决了。谢谢。
  • @Tazz 在这种情况下,最好写一个说明解决方案的答案并接受它。这将帮助其他偶然发现该问题的人找到正确答案。
  • 我会将其添加为答案。

标签: r choroplethr


【解决方案1】:

名称的格式是小写字符串。但它必须是一个字符串。示例代码具有未引用的 ohio,因此 R 试图将其解释为变量名。只需引用字符串即可。

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

【讨论】:

    猜你喜欢
    • 2020-07-17
    • 2012-11-24
    • 2012-11-27
    • 1970-01-01
    • 1970-01-01
    • 2011-02-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多