Calculate Spearman and Pearson correlation on variables of different units If for example I have the following data
X     Y
3.2   0
1.5   0
6.5   3
2.4   1
6.2   3

where X is a value between 1 (best case) and 7 (worst case)
and Y is a value between 0 (best case) and 3 (worst case)
and I would like to compute Spearman or Pearson correlation between X and Y.
Do I need to convert into values with similar units?
 A: Dave is already correct in his answer. The formula for the correlation is a unitless measure. Here I use R for illustration. If you scale your x and y values and run a correlation on them:
#### Correlation of Raw Units ####
x <- c(3.2,1.5,6.5,2.4,6.2)
y <- c(0,0,3,1,3)
scale.x <- scale(x)
scale.y <- scale(y)
cor(scale.x,scale.y)

This gives you $r = .93$:
         [,1]
[1,] 0.929868

If you run a correlation of the raw values using cor(x,y) instead, you get the same result:
> cor(x,y)
[1] 0.929868

So you do not need to worry about the items being on different scales. You can simply run the correlation as is.
A: I take it you are asking whether it makes sense to compute Pearson/Spearman correlations between variables expressed in different units or whether some prior conversion is required instead.
First, neither the Pearson nor the Spearman correlation measures require the variables $X$ and $Y$ to be expressed in the same "units". Actually, if you apply any (invertible) affine transformation to $X$ and $Y$, both these measures of correlation will be unchanged[1]. As a matter of fact, in general we are interested in correlations between incommensurable variables that cannot be expressed in identical units (consider the correlation between, say, Gross Domestic Product in $ and energy consumption in TWh for instance). Therefore it makes sense to seek measures of correlation that would work for such cases.
Still, there is something worthy of being noted that pertains to the scales to which $X$ and $Y$ belong.
Let us say that $X$ is a length. Then the correlation between $X$ and $Y$ should not depend on which unit $X$ is expressed in (e.g. meters or inches or light-years). As a result, the correlation metric should be invariant upon transformations of the form $X\mapsto aX$ (any conversion from one length unit to another). In that case, Pearson and Spearman metrics are a good fit.
Now, let us assume that $X$ is a temperature. Then it should not matter for the correlation whether it is expressed in Celsius, Fahrenheit or kelvin. Then the correlation measure should remain invariant with respect to affine transformations ($X\mapsto aX+b$). Again Pearson and Spearman correlations are invariant wrt such transformations.
However, assume that $X$ now measures something such like the hardness of minerals, in Mohs' scale of hardness for instance. This scale is established by assessing which minerals can scratch which minerals. This allows to "rank" minerals by "hardness", depending on which minerals they can or cannot scratch: the hardness $x_m$ of a material $m$ is larger than that of a material $n$ ($x_m>x_n$) if and only if $m$ can scratch $n$. But that leaves $X$ strongly underdetermined: any monotonically increasing transformation $f$ of $X$ (e.g: $x\mapsto x^2$) preserves the ranking of the materials. So given $X$ as expressed in any scale of hardness (e.g. Mohs' scale), we cannot tell whether it is more warranted than $X^2$, $\exp(X)$, etc. (any monotonically increasing transformation of $X$). However, Pearson's correlation is not invariant with respect to such transformations. Therefore the value or Pearson's correlation between $X$ and $Y$ will in general depend on which hardness scale we use. It is not the case of Spearman's correlation, however. Spearman's correlation remains invariant when monotonically increasing transformations are applied to $X$ or $Y$. So in that case, Pearson's R is less well-founded (because its value will be sensitive to the choice of the scale for $X$, which is somewhat arbitrary), but Spearman's correlation remains a sensible choice.
Coming back to your case, what lesson can you draw from this?

*

*Pearson correlation is invariant with respect to linear and affine transformations1.

*Spearman correlation is invariant with respect to monotonic transformations1 (it is more robust).

*If you cannot tell which variable is more relevant to your problem between, say, $X,X^2$ or $f(X)$ where $f$ is any monotonically increasing transformation  (e.g. as in the case of minerals hardness) than it makes much less sense to calculate Pearson correlations, because the value of R will depend on an arbitrary choice between any of these otherwise physically equivalent scales.

Long-story short: you do not need identical units for computing Pearson or Spearman correlations between variables. However, you need to understand the basic properties of the scales to which they belong, in order to know if it makes sense to use these measures.

1 Up to a sign factor ($\pm 1$)
A: The formula for correlation is $\rho_{X,Y} = \frac{E(XY)-E(X)E(Y)}{\sqrt{(E(X^2)-E(X)^2)(E(Y^2)-E(Y)^2}}, ~E(\cdot) $ is the expected value (basically, the average value). The units of an expected value of something are the same as the units of that something, so if we're just looking at the units, we can simplify that tp $\frac{XY-XY}{\sqrt{X^2Y^2}}=\frac{XY}{XY}=1$. The square of the correlation coefficient represents what portion of the total variance is the variables varying "together", as opposed to them varying separately. As a ratio between two things with the same units, it's dimensionless.
A: Pearson correlation, $\rho_{XY}$, divides through by the product of the units and results in a unitless measure.
$$
\rho_{XY}=\dfrac{
\text{cov}\left(X,Y\right)
}{
\sigma_X\sigma_Y
}
$$
The covariance in the numerator has the product of the original units as its units, and then the denominator divides through by that product of units to result in a unitless quantity.
Spearman correlation is the Pearson correlation of the ranks, so similar logic applies (even if you consider the ranks to have units).
