#打开原始数据并命名位chushi
chushi=read.csv("shaoyang.csv")
View(chushi)
原始数据
dim(chushi)
[1] 25 36
#把第列名更为为patient+数字
rownames(chushi) <- paste0(rep("patient",times=25),1:25)
rownames(chushi)
colnames(chushi)
#去掉第一列
gg=chushi[,-1]
#
View(gg)
#FOR循环
nm <- gg[,2]
for (i in 1:25)
{ do
cod <- nm[i]
data1=gg[i,]
filename <- paste(cod, 'csv', sep='.')
write.csv(data1,filename,row.names = F)
}
网友评论