这篇具有很好参考价值的文章主要介绍了R语言【taxa】——roots(),stems(),subtaxa(),supertaxa():获取根节点、茎节点、子类群和父类群。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。
roots(x, subset = NULL)
在 taxonomy 中查找根节点类群的索引值。
> x <- taxonomy(c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo',
+ 'Panthera tigris', 'Ursidae', 'Ursus', 'Ursus arctos'),
+ supertaxa = c(NA, 1, 2, 3, 3, 1, 6, 7))
> roots(x)
[1] 1
> roots(x, subset = 2:8)
[1] 2 6
stems(x, value = NULL, ...)
返回每个类群的茎节点的索引值。
> x <- taxonomy(c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo',
+ 'Panthera tigris'),
+ supertaxa = c(NA, 1, 2, 3, 3))
> x <- c(x, x)
> stems(x)
[[1]]
[1] 1 2
[[2]]
[1] 6 7
> stems(x, value = tax_name(x))
[[1]]
[1] "Carnivora" "Felidae"
[[2]]
[1] "Carnivora" "Felidae"
> x
<taxonomy[10]>
1: Carnivora
└─2: Felidae
└─3: Panthera
├─4: Panthera leo
└─5: Panthera tigris
6: Carnivora
└─7: Felidae
└─8: Panthera
├─9: Panthera leo
└─10: Panthera tigris
subtaxa(x, subset = NULL, max_depth = NULL, include = FALSE, value = NULL, ...)
返回所有子类群的索引值。文章来源:https://www.toymoban.com/news/detail-821103.html
# Generate example data
x <- taxonomy(c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo',
'Panthera tigris', 'Ursidae', 'Ursus', 'Ursus arctos'),
supertaxa = c(NA, 1, 2, 3, 3, 1, 6, 7))
# The indexes of all subtaxa (with subtaxa of subtaxa, etc) for each taxon
subtaxa(x)
# The indexes of immediate subtaxa (without subtaxa of subtaxa, etc) for each taxon
subtaxa(x, max_depth = 1)
# Return something other than index
subtaxa(x, value = tax_name(x))
# Include each taxon with its subtaxa
subtaxa(x, value = tax_name(x), include = TRUE)
# Only return data for some taxa (faster than subsetting the whole result)
subtaxa(x, subset = 3)
supertaxa( x, subset = NULL, max_depth = NULL, include = FALSE, value = NULL, use_na = FALSE, ... )
返回所有父类群的索引值。文章来源地址https://www.toymoban.com/news/detail-821103.html
# Generate example data
x <- taxonomy(c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo',
'Panthera tigris', 'Ursidae', 'Ursus', 'Ursus arctos'),
supertaxa = c(NA, 1, 2, 3, 3, 1, 6, 7))
# The indexes of all supertaxa (with supertaxa of supertaxa, etc) for each taxon
supertaxa(x)
# Return something other than index
supertaxa(x, value = tax_name(x))
# Include each taxon with its supertaxa
supertaxa(x, value = tax_name(x), include = TRUE)
# Only return data for some taxa (faster than subsetting the whole result)
supertaxa(x, subset = 3)
到了这里,关于R语言【taxa】——roots(),stems(),subtaxa(),supertaxa():获取根节点、茎节点、子类群和父类群的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!