cor.test for several parameters - automated Spearman rank correlations?

Is there a way to automate the cor.test command (or extend it) for several variables? For example if you have 10 variables and you are interested in the correlation of each variable with each of the other variables - would you then have to repeat the cor.test command for each combination of variables or does a shortcut exist? I'm using RStudio version 3.5.2.

Hi there,

If you can provide some data I'd be happy to help you :slight_smile: See how to make a reprex here: FAQ: How to do a minimal reproducible example ( reprex ) for beginners

Thank you! I have reduced my dataset, but this is an example:

data <- data.frame(

Then I make a correlation matrix:
matrix <- as.dist(round(cor(data,method="spearman"),2))

And now I want to test the correlations, but don't know how to do it automated as described in my post.

Have a look here so long: Pair wise cor.test based on combinations of variables

When I get time I will look at your data and see how best to do it.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.