title: "生信技能树学习笔记"
引用自生信技能树 author: "天空"
date: "2023-01-02"
output: html_document
#1.读取ex1.txt
ex1 <- read.table("day3/R_02/ex1.txt")
ex1[1:3,1:3]
## V1
## 1 id
## 2 66e33592-2e6e-4e50-8a5b-8a3f902eb2b5
## 3 142aea0e-7a7b-4ac4-9dbb-0f62e2379599
## V2 V3
## 1 filename md5
## 2 nationwidechildrens.org_clinical.TCGA-4G-AAZO.xml 740edde27e113bca1454defaffe50378
## 3 nationwidechildrens.org_clinical.TCGA-W5-AA2O.xml b83ddabb84f4a71ad3fa95cae64d0b10
ex1 <- read.table("day3/R_02/ex1.txt",header = T)
ex1[1:3,1:3]
## id
## 1 66e33592-2e6e-4e50-8a5b-8a3f902eb2b5
## 2 142aea0e-7a7b-4ac4-9dbb-0f62e2379599
## 3 9d951ff8-ce21-4c69-86f2-0d1eeb2e40e3
## filename md5
## 1 nationwidechildrens.org_clinical.TCGA-4G-AAZO.xml 740edde27e113bca1454defaffe50378
## 2 nationwidechildrens.org_clinical.TCGA-W5-AA2O.xml b83ddabb84f4a71ad3fa95cae64d0b10
## 3 nationwidechildrens.org_clinical.TCGA-W5-AA31.xml ae4382dde26cb733ad388df197e6947b
#2.读取ex2.csv
ex2 <- read.csv("day3/R_02/ex2.csv")
ex2[1:3,1:3]
## X TCGA.06.0238.01A TCGA.06.0171.02A
## 1 NCKAP1L 10.96088 13.67818
## 2 SYK 10.64797 12.99044
## 3 PTPRC 10.61789 13.49278
#check.names = F:不检查文件中的特殊字符
ex2 <- read.csv("day3/R_02/ex2.csv",row.names = 1,check.names = F)
ex2[1:3,1:3]
## TCGA-06-0238-01A TCGA-06-0171-02A TCGA-28-5218-01A
## NCKAP1L 10.96088 13.67818 11.69558
## SYK 10.64797 12.99044 11.07856
## PTPRC 10.61789 13.49278 11.26111
#注意:数据框不允许重复的行名
# rod = read.csv("day3/R_02/rod.csv",row.names = 1)
rod = read.csv("day3/R_02/rod.csv")
正确的读入方式
#3.读取soft.txt
# soft <- read.table("day3/R_02/soft.txt")
soft <- read.table("day3/R_02/soft.txt",header = T,fill = T) #其实不对
soft2 <- read.table("day3/R_02/soft.txt",header = T,sep = "\t")
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。