R: Using cor.test on multiple columns on a data frame
<p>It know it seems like a pretty simple question, but I can't find the answer cause i'm new in R programing.
I have a df composed by a first ID column (treated and not patients) and several columns of metabolic variables.
I'm trying to write a simple script that could allow me to make a spearman correlation of the first column with all the other variables.
I've tried with the "apply" function like: apply(df,2,cor) but it does not work thus I imagine i should try to use a for loop...do you have any sugestion to how perform it?
thank you all</p>