您好,登錄后才能下訂單哦!
本篇內容介紹了“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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。