即矩阵元素为第一行1,2,3,4;第二行2,3,4,5;对他们两行进行粘贴为12,23,34,45;矩阵由多行,两两粘贴的情况下,怎么不使用for循环写出来,用for数据大的话会很慢
我的代码是这个样子的:
n<-1
for (i in 1:(nrow(GO_matrix)-1)) {
for (j in (i+1):nrow(GO_matrix)) {
x1<-GO_matrix[i,]
x2<-GO_matrix[j,]
x3<-paste(x1,x2,sep = "")
gene_gene[n,]<-x3
n<-n+1
}
}
怎么能去掉for循环,谢谢。