How to test using Spearman correlation in R?

#1
Given such data
X-Y
2-6
4-9
6- 3
8- 12
10- 15

When using pearson correlation it will be straight forward, however, when using spearman, should we arrange the data before running the test? Something like

X- Order X ** Y - Order Y
2-1 ** 6
4-2 ** 9
6- 3 ** 3
8- 4 ** 12
10- 5 ** 15

then we order according to Y
X- Order X ** Y - Order Y
6- 3 ** 3 - 1
2-1 ** 6 - 2
4-2 ** 9-3
8- 4 ** 12 - 4
10- 5 ** 15 - 5

Then we compare the ranks
Order X ** Order Y
3 ** 1
1 ** 2
2 ** 3
4 ** 4
5 ** 5
 

Dason

Ambassador to the humans
#2
Are you asking about how to do it in general or how to do it in R (the stats programming language)?
 

Dason

Ambassador to the humans
#4
R will take care of it for you if you're using cor or cor.test (assuming you add method="spearman" of course).