引用于微信公众号--生信星球
x<-rep(1:3,times=2)根据元素位置
x[c(1,5)]根据值
x[x==2]1.读取本地数据
read.table(file = "huahua.txt",sep = "\t",header=T)
a<-read.table(file = "huahua.txt",sep = "\t",header=T)2.设置行名和列名
X<-read.csv('doudou.txt')
colnames(X)
row.names(X)
colnames(X)[1]<-"bioplanet"
X<-read.csv(file = "huahua.txt",sep = " ",header = T,row.names = 1)3.数据框的导出
write.table(X,file = "yu.txt",sep = ",",quote=F)4.变量的保存与重新加载
save.image(file="bioinfoplanet.RDate")
save(X,file="test.RData")
load("test.RData")5.提取元素
X[x,y]
X[x,]
X[,y]
X[a:b]
X[c(a,b)]
X$X16.直接使用数据框中的变量
plot(iris$Sepal.Length,iris$Sepal.Width)
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。