Tuesday, 10 September 2013

How to find the correlation coefficients on a matrix of scatterplots in R?

How to find the correlation coefficients on a matrix of scatterplots in R?

I am using R coding. Given data with three columns of various x-values and
one column of y-values for a scatterplot, I created a 4x4 matrix of
scatterplots using the command:
plot(info45)
(I named the table of information "info45".) I also saw in this YouTube
video http://www.youtube.com/watch?v=FS9E907bbcA that you can use the
command pair(info45) and this worked just the same.
Following the example in the above video, I wanted to find the
correlations of the scatterplots. I entered the command: cor(info45) but
it returns the message "Error in cor(info45) : 'x' must be numeric". I am
not sure if this helps, but the column headers in the data table are V1,
V2, V3, and V4. In fact, here's the data table itself:
V1 V2 V3 V4
1 X1 X2 X3 Y
2 14.620 226.00 7.000 128.40
3 15.630 220.00 3.375 52.62
4 14.620 217.40 6.375 113.90
5 15.000 220.00 6.000 98.01
6 14.500 226.50 7.625 139.90
7 15.250 224.10 6.000 102.60
8 16.120 220.50 3.375 48.14
9 15.130 223.50 6.125 109.60
10 15.500 217.60 5.000 82.68
11 15.130 228.50 6.625 112.60
12 15.500 230.20 5.750 97.52
13 16.120 226.50 3.750 59.06
14 15.130 226.60 6.125 111.80
15 15.630 225.60 5.375 89.09
16 15.380 229.70 5.875 101.00
17 14.380 234.00 8.875 171.90
18 15.500 230.00 4.000 66.80
19 14.250 224.30 8.000 157.10
20 14.500 240.50 10.870 208.40
21 14.620 223.70 7.375 133.40
What command(s) should I enter to get a matrix of correlation coefficients
as the speaker does in the video?

No comments:

Post a Comment