【发布时间】:2017-02-10 08:11:04
【问题描述】:
我有一个需要转换为标准化格式 (iso3c) 的国家/地区列表。有些名字很长,有些有 2 位或 3 位数字代码,还有一些不显示整个国家/地区名称,例如“非洲”而不是“南非”。我做了一些研究并想在 R 中使用 countrycode 包。但是,当我尝试使用“正则表达式”时,R 似乎无法识别它。我收到以下错误:
> countrycode(data,"regex","iso3c", warn = TRUE)
Error in countrycode(data, "regex", "iso3c", :
Origin code not supported
我还需要做什么?
谢谢!
【问题讨论】:
-
你好。为了帮助制作可重现的示例,您可以使用
reproduce(<your data>)。说明在这里:bit.ly/SORepro - How to make a great R reproducible example -
@dixi 请检查此链接github.com/vincentarelbundock/countrycode 我猜
regex不是这里的选项。相反,当您使用cown、cowc等任何选项时,它使用countrycode_data中指定的regex进行转换。 -
我明白了.. 我使用了该文档,但没有正确理解它。谢谢!
标签: regex r country-codes