Dear all,
I am running a function "results", which is basically al loop over 10000 genes and it fetches the results of two parameter (coefficient and z value) for each gene.
I then combine all results for all genes with allResults <- do.call(rbind, results).
Now my issue is that I would like to keep the gene name as well (not only the coefficient and zvalue).
I am not quite sure how to fix this.
This is the complete code (currently set to 5 genes):
results <- lapply(1:5, function(i){
expr<-as.vector(predicted_gene[,i] )
resi <- multinom(tgroup2 ~ sex + age + Site_Category+ expr, data = pheno)
print(i)
coef<-c(summary(resi)$coefficients[1,6],
summary(resi)$coefficients[1,6]/summary(resi)$standard.errors[1,6])
names(coef)<-colnames(predicted_gene[,i])
}
)
names(coef)
allResults <- do.call(rbind, results)
View(allResults)
The result is only this:
I would like it to have the gene name instead of 1-5 in the first column.
Thank you for any hint!