Generating a simple correlation plot
Correlation plots are a great tool to visualize correlation data. When two sets of data are related to one another, we say they are correlated. Hence, correlation can be negative, positive, or 0 (implying no correlation). The strength of the relationship can be defined by the correlation coefficient, which ranges from -1 (strong negative correlation) to 1 (strong positive correlation). What this implies is that when one series moves, the other series is most likely to move. The direction of the movement depends on the sign and the coefficient. Readers should note that correlation does not imply causation. Google Correlate allows its users to perform correlation on real world data.
Getting ready
We need to install and load the following two packages in R:
corrplot
quantmod
How to do it…
For the purpose of this recipe, we will download foreign exchange data of various currencies by using the quantmod
package:
rates=c("USD/EUR","USD/GBP","USD/CHF","USD/JPY...