'Spearmans correlations on a subset of my data

I am trying to perform spearmans correlations on a subset of my data, but each time I am getting the same p value and rho as when I conduct the test on my entire dataset.

This is the code for the test on my entire data set cor.test(analytic_data_survey$mvd_score, analytic_data_survey$total_jealousy_score, method = "spearman")

this is the output: S = 209441, p-value = 0.06342 alternative hypothesis: true rho is not equal to 0 sample estimates: rho 0.1736731

This is the code for the test I am trying to do on a subset of my data (females): cor.test(analytic_data_survey$mvd_score, analytic_data_survey$total_jealousy_score, subset = sex == "Female", method = "spearman")

and you can see the output is the same: S = 209441, p-value = 0.06342 alternative hypothesis: true rho is not equal to 0 sample estimates: rho 0.1736731

I am fairly new to R so I'm unsure if there is another way to conduct this test on a subset of my dataset. Any guidance would be greatly appreciated!

r


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source