如何解决在 R 中创建 Nexus 文件
mt = matrix(c(rep(1:5,times = 2),NA,2,5,4,1,3,1),nrow=10)
rownames(mt) <- paste(rep("taxon",10),1:10)
colnames(mt) = c("color","type")
mt
color type
taxon 1 1 NA
taxon 2 2 2
taxon 3 3 5
taxon 4 4 2
taxon 5 5 4
taxon 6 1 1
taxon 7 2 2
taxon 8 3 5
taxon 9 4 3
taxon 10 5 1
创建我正在使用的 ```mt````(格式标准 - 分类矩阵)的 nexus 文件:
charstate = write.nexus.data(mt,file = "charstate.nex",format ="stand",datablock = T)
这将导致:
#NEXUS
[Data written by write.nexus.data.R,Sun Mar 07 13:19:14 2021]
BEGIN DATA;
DIMENSIONS NTAX=10 NCHAR=2;
FORMAT DATATYPE=STANDARD MISSING=? GAP=- INTERLEAVE=NO symbols="0123456789";
MATRIX
taxon 1 1NA
taxon 2 22
taxon 3 35
taxon 4 42
taxon 5 54
taxon 6 11
taxon 7 22
taxon 8 35
taxon 9 43
taxon 10 51
;
END;
但是,我还想在我的 NEXUS 文件中包含 CHARSTATELABELS。示例:
#NEXUS
[Data written by write.nexus.data.R,Sun Mar 07 13:19:14 2021]
BEGIN DATA;
DIMENSIONS NTAX=10 NCHAR=2;
FORMAT DATATYPE=STANDARD MISSING=? GAP=- INTERLEAVE=NO symbols="0123456789"
CHARSTATELABELS
1 'color (1 blue,2 yellow,3 red,4 black,5 white)'
2'type(1 big,2 short,3 medium,4 big-short,5 medium-short)'
;
MATRIX
此外,您可以看到符号没有显示正确的编码状态。右边应该是 symbols = "012345" 而不是最初描述的 0 到 9。 如何包含 CHARSTATELABELS 和正确的 ** 符号**?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。