I want to create a scatterplot Matrix between a group of variables (not all!) in my dataframe.
A quick snapshot of my dataFrame:
V1 V2 V3 V4 V5 V6 V7 R1 R2
.08 .05 .93 .1 .21 .32 .21 .09 .07
.43 .12 .1 .40 .07 .98 .25 .10 .05
The two groups are V1 to V7 and R1-R2. So what I'm trying to achieve is a plot between V1-R1, V1-R2, V2-R1.......V7-R2. I do not want to plot V1-V2, V1-V4 etc.
I figured an easy way to get to this would be to split my dataframe into two which would enable me to achieve my goal.
So I split my dataframe into two as below:
dataFrame1<-dataframe[,1:7]
dataFrame2<-dataframe[,8:9]
This works well as far as getting the correlation table out from R is concerned:
cor(dataFrame1,dataFrame2)
however the plotting bit is a bit of a challenge.
I have thus far tried ggpairs, car and scatterplotMatrix and none of them seem to work.
For ggpairs using the current code as below:
ggpairs (dataFrame1, dataFrame2)
I get the following error message
Make sure your 'columns' values are positive.
Of course the above dataFrame is just a sample of the entire dataset and hence you cannot see any negatives in R1 and R2.
I don't want to manually do it in ggplot2 and then use glob to merge into a single plot. Also I don't want to plot the matrix for all the variables as is because that is not what I am trying to achieve.
Is there another way to get to what I'm after?
Thanks.
