本文主要是介绍R语言【taxa】——n_subtaxa(),n_supertaxa():每个类群的子类群数量和父类群数量,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Package taxa version 0.4.2
n_subtaxa(x, subset = NULL, max_depth = NULL, include = FALSE)
参数【x】:获取子类群的对象,比如 taxonomy。
参数【subset】:检索的树的子集。索引或名称。
参数【max_depth】:挖掘的等级深度。比如,max_depth = 1 表示值返回直接子类群。默认返回所有子类群。
参数【include】:为TRUE时,输出每个类群的信息。
> x <- taxonomy(c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo',
+ 'Panthera tigris', 'Ursidae', 'Ursus', 'Ursus arctos'),
+ supertaxa = c(NA, 1, 2, 3, 3, 1, 6, 7))
> x<taxonomy[8]>
1: Carnivora
├─2: Felidae
│ └─3: Panthera
│ ├─4: Panthera leo
│ └─5: Panthera tigris
└─6: Ursidae└─7: Ursus└─8: Ursus arctos
> n_subtaxa(x) [1] 7 3 2 0 0 2 1 0
> n_subtaxa(x, max_depth = 1) [1] 2 1 2 0 0 1 1 0
n_supertaxa(x, subset = NULL, max_depth = NULL, include = FALSE)
参数同 n_subtaxa()。
> x <- taxonomy(c('Carnivora', 'Felidae', 'Panthera', 'Panthera leo',
+ 'Panthera tigris', 'Ursidae', 'Ursus', 'Ursus arctos'),
+ supertaxa = c(NA, 1, 2, 3, 3, 1, 6, 7))> n_supertaxa(x)
[1] 0 1 2 3 3 1 2 3> n_supertaxa(x, subset = 1:3)
[1] 0 1 2
这篇关于R语言【taxa】——n_subtaxa(),n_supertaxa():每个类群的子类群数量和父类群数量的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!