Spearman’s Rank Correlation and its context
Spearman correlation coefficient is applied where one or both the variable are qualitative in nature.

Where Di is the difference of ranks of ith data point.
The t-test formula to test the hypothesis, no correlation,

cor(mtcars$mpg, mtcars$hp, method = "spearman") # Ranked correlation
cor.test(mtcars$mpg, mtcars$hp, method = "spearman")

Kendall’s Tao
We use Kandall’s Tao in the following situation:

cor(mtcars$gear, mtcars$carb, method = "kendall")
cor.test(mtcars$gear, mtcars$carb, method = "kendall")

Statlearner
Statlearner