本篇内容介绍了“R语言的参数check.names有什么用”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
R语言在读取数据 例如read.table 添加check.names=F 参数可以保证数据种特殊的字符正常读取:
如数据表头 “-”被认为是“."
> A=read.table("F:/test/WGCNA/data/fpkm/All.DEG_final_3000.xls",sep="\t",check.names=T,header=T) > head(A,2) ID CK.WT.1 CK.WT.2 CK.WT.3 CK.tdr1.1 CK.tdr1.2 CK.tdr1.3 NaWT.1 NaWT.2 NaWT.3 1 AT1G01010 3.74149 7.3618 5.81734 5.71131 7.97054 10.37620 6.29949 5.55062 5.84779 2 AT1G01030 5.23528 2.7707 2.66859 3.22632 1.32105 1.96726 2.40259 3.23077 4.80378 Natdr1.1 Natdr1.2 Natdr1.3 Na.WT.1 Na.WT.2 Na.WT.3 Na.tdr1.1 Na.tdr1.2 Na.tdr1.3 1 15.58810 14.76360 17.74670 9.84943 7.97949 6.841060 13.29120 25.37000 19.59940 2 2.04301 2.29524 1.95286 1.83377 1.70757 0.809564 3.23172 1.80478 2.06044 SWT.1 SWT.2 SWT.3 Stdr1.1 Stdr1.2 Stdr1.3 1 4.96687 5.53349 3.18816 6.93650 7.88402 11.25040 2 8.49256 2.65564 2.25570 4.35298 4.52147 7.11351 > A=read.table("F:/test/WGCNA/data/fpkm/All.DEG_final_3000.xls",sep="\t",check.names=F,header=T) > head(A,2) ID CK-WT-1 CK-WT-2 CK-WT-3 CK-tdr1-1 CK-tdr1-2 CK-tdr1-3 NaWT-1 NaWT-2 NaWT-3 1 AT1G01010 3.74149 7.3618 5.81734 5.71131 7.97054 10.37620 6.29949 5.55062 5.84779 2 AT1G01030 5.23528 2.7707 2.66859 3.22632 1.32105 1.96726 2.40259 3.23077 4.80378 Natdr1-1 Natdr1-2 Natdr1-3 Na-WT-1 Na-WT-2 Na-WT-3 Na-tdr1-1 Na-tdr1-2 Na-tdr1-3 1 15.58810 14.76360 17.74670 9.84943 7.97949 6.841060 13.29120 25.37000 19.59940 2 2.04301 2.29524 1.95286 1.83377 1.70757 0.809564 3.23172 1.80478 2.06044 SWT-1 SWT-2 SWT-3 Stdr1-1 Stdr1-2 Stdr1-3 1 4.96687 5.53349 3.18816 6.93650 7.88402 11.25040 2 8.49256 2.65564 2.25570 4.35298 4.52147 7.11351
data.frame() 函数在进行数据框组合时也存在 字符变化,需要设置check.names=F
数据框:
> A1=A[,1:12] > head(A1,2) ID CK-WT-1 CK-WT-2 CK-WT-3 CK-tdr1-1 CK-tdr1-2 CK-tdr1-3 NaWT-1 NaWT-2 NaWT-3 1 AT1G01010 3.74149 7.3618 5.81734 5.71131 7.97054 10.37620 6.29949 5.55062 5.84779 2 AT1G01030 5.23528 2.7707 2.66859 3.22632 1.32105 1.96726 2.40259 3.23077 4.80378 Natdr1-1 Natdr1-2 1 15.58810 14.76360 2 2.04301 2.29524 > A2=A[,13:24] > head(A2,2) Natdr1-3 Na-WT-1 Na-WT-2 Na-WT-3 Na-tdr1-1 Na-tdr1-2 Na-tdr1-3 SWT-1 SWT-2 SWT-3 1 17.74670 9.84943 7.97949 6.841060 13.29120 25.37000 19.59940 4.96687 5.53349 3.18816 2 1.95286 1.83377 1.70757 0.809564 3.23172 1.80478 2.06044 8.49256 2.65564 2.25570 Stdr1-1 Stdr1-2 1 6.93650 7.88402 2 4.35298 4.52147
组合:
> B=data.frame(A1,A2) > head(B,2) ID CK.WT.1 CK.WT.2 CK.WT.3 CK.tdr1.1 CK.tdr1.2 CK.tdr1.3 NaWT.1 NaWT.2 NaWT.3 1 AT1G01010 3.74149 7.3618 5.81734 5.71131 7.97054 10.37620 6.29949 5.55062 5.84779 2 AT1G01030 5.23528 2.7707 2.66859 3.22632 1.32105 1.96726 2.40259 3.23077 4.80378 Natdr1.1 Natdr1.2 Natdr1.3 Na.WT.1 Na.WT.2 Na.WT.3 Na.tdr1.1 Na.tdr1.2 Na.tdr1.3 1 15.58810 14.76360 17.74670 9.84943 7.97949 6.841060 13.29120 25.37000 19.59940 2 2.04301 2.29524 1.95286 1.83377 1.70757 0.809564 3.23172 1.80478 2.06044 SWT.1 SWT.2 SWT.3 Stdr1.1 Stdr1.2 1 4.96687 5.53349 3.18816 6.93650 7.88402 2 8.49256 2.65564 2.25570 4.35298 4.52147 > B=data.frame(A1,A2,check.names=F) > head(B,2) ID CK-WT-1 CK-WT-2 CK-WT-3 CK-tdr1-1 CK-tdr1-2 CK-tdr1-3 NaWT-1 NaWT-2 NaWT-3 1 AT1G01010 3.74149 7.3618 5.81734 5.71131 7.97054 10.37620 6.29949 5.55062 5.84779 2 AT1G01030 5.23528 2.7707 2.66859 3.22632 1.32105 1.96726 2.40259 3.23077 4.80378 Natdr1-1 Natdr1-2 Natdr1-3 Na-WT-1 Na-WT-2 Na-WT-3 Na-tdr1-1 Na-tdr1-2 Na-tdr1-3 1 15.58810 14.76360 17.74670 9.84943 7.97949 6.841060 13.29120 25.37000 19.59940 2 2.04301 2.29524 1.95286 1.83377 1.70757 0.809564 3.23172 1.80478 2.06044 SWT-1 SWT-2 SWT-3 Stdr1-1 Stdr1-2 1 4.96687 5.53349 3.18816 6.93650 7.88402 2 8.49256 2.65564 2.25570 4.35298 4.52147
“R语言的参数check.names有什么用”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。