I have read that wealthier states tend to vote Democratic while poorer states tend to vote Republican. There is data that backs this up. What is the correlation between statewide median incomes and 2 party Democratic vote percentages?
As indicated in the comments, a simple correlation is not hard to do. You don't need R, Google sheets will do fine:
The percentage voting Democrat in 2020 can be predicted from the average wealth by the formula Democrat-party-percentage = (wealth÷1265)% and R²=0.48 so roughly half the variation between states can be explained by this factor.
But repeat after me... correlation isn't causation
This is somewhat surprising as until 2012, richer people tend to vote Republican, see Columbia U report. As Relaxed notes, it's not really that surprising once you realise that the correlations tell you something different, and they both can be substantial in opposite direction at the same time. Jumping from group correlations to individual correlations is known as the “ecological fallacy”.