问题描述
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 (将#修改为@)