你可以使用R语言如何通过通用名称获取科学名称?

huangapple go评论57阅读模式
英文:

How can I fetch scientific name using common name in R?

问题

"get_scientific_name("avocado") should result in c("Persea americana")."
"Some of the relevant packages that I came across was rgbif and [taxize][2] ?"
"1: https://docs.ropensci.org/rgbif/"
"2: https://docs.ropensci.org/taxize/reference/index.html#the-plant-list"
"Specifically I am interested in names of crops."

英文:

E.g.
get_scientific_name("avacado") should result in c("Persea americana").
Some of the relevant packages that I came across was rgbif and [taxize][2] ?

Specifically I am interested in names of crops.

答案1

得分: 2

你可以编写一个小包装器来解析taxize包中pow_search的结果:

get_scientific_name <- function(name) {
  taxize::pow_search(name)$data$name[1]
}

对几种作物的通用名称进行测试似乎得到了合理的结果:

get_scientific_name('avocado')
#> [1] "Persea americana"

get_scientific_name('sweetcorn')
#> [1] "Zea mays"

get_scientific_name('carrot')
#> [1] "Daucus carota"

get_scientific_name('spelt')
#> [1] "Triticum spelta"

创建于2023-06-12,使用 reprex v2.0.2

英文:

You can write a little wrapper to parse the results from pow_search in the taxize package:

get_scientific_name &lt;- function(name) {
  taxize::pow_search(name)$data$name[1]
}

Testing on the common name of several crops seems to give sensible results:

get_scientific_name(&#39;avocado&#39;)
#&gt; [1] &quot;Persea americana&quot;

get_scientific_name(&#39;sweetcorn&#39;)
#&gt; [1] &quot;Zea mays&quot;

get_scientific_name(&#39;carrot&#39;)
#&gt; [1] &quot;Daucus carota&quot;

get_scientific_name(&#39;spelt&#39;)
#&gt; [1] &quot;Triticum spelta&quot;

<sup>Created on 2023-06-12 with reprex v2.0.2</sup>

答案2

得分: 0

根据 @Allan Cameron 的回答,taxize 包含了根据普通名称获取科学名称的函数。

taxize::comm2sci("avocado")

返回结果:

$avocado
[1] "Persea americana"
英文:

Expanding on @Allan Cameron's answer, taxize package has functions to get the scientific names based on common names.

taxize::comm2sci(&quot;avocado&quot;)

returns

$avocado
[1] &quot;Persea americana&quot;

huangapple
  • 本文由 发表于 2023年6月12日 22:28:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/76457652.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定