I am trying to iterate through a vector that runs a function for each iteration and writes an output of that function to a .csv file.
Each entry in gene_ID_temp
is a character that is inputted into transcript_proportions
. For each entry, I am trying to run transcript_proportions
and write the output to a .csv file with a different number.
gene_ID=data.frame(RNA_transcript_RPKM[,773])
gene_ID_unique <- unique(gene_ID)
gene_ID_temp=data.frame(gene_ID_unique[1:3,])
a=1
for (i in gene_ID_temp)
{
transcript_proportions(RNA_transcript_RPKM_MUSCLE,i)
write.csv(Regression_Values,paste0(a,".csv"))
a=a+1
}
Currently, it seems to be only writing one file "1.csv" that is a combination of the outputs from the iterations and it isn't writing a separate file for each iteration. Also I'm not sure that the "a" variable is actually changing.
How do I solve the problem?