I am trying to create a label to the combn command so that I know exactly which pairs where compared.
Here's an example:
Let a be my vector of interest,
a<-seq(1,10,1)
c<-combn(a,2)
So I want to create a vector label with the numbers that are paired:
label<-rep("abc",times=ncol(c)) #This is just a vector to initialized "label"
head(label)
for(i in ncol(c)){
label[i]<-c(paste("Exon",c[1,i],"with",c[2,i]))
}
head(label)
The problem is when I run the for loop it doesn't work. Alternatively, it only outputs the last comparison.
ncol(c)is only a single value. You have to use something like1:ncol(c)orseq(along=label).