我对R来说很新,所以这可能很容易解决。
我有一个由代表不同变量的几列组成的数据框。我想进行多重关联,将所有变量配对。
这是我的数据框:
df <- structure(list(ATA = c(26.41, 35.89, 42.68, 41.92, 37.43, 32.72,
31.97, 18.59, 38.71, 38.74, 28.61, 21.31, 38.66, 42.82, 46.17,
28.39, 28.17, 39.24, 42.44, 31.56, 41.95, 37.52, 32.15, 51.96,
33.37, 32.8, 31.92, 40.21, 41.71, 32.61, 35.97, 42.44, 37.36,
35.35, 37.08, 41.42, 43.71, 47.29, 31.22, 19.72, 23.74, 38.2,
47.27, 47.47, 40.17, 37, 37.6, 37.5, 34.78, 35.43, 39.32, 42.63,
42.52, 36.37, 36.71, 34.48, 40.06, 47.65, 37.1, 18.52, 36.98,
14.44, 44.46, 26.61, 32.13, 33.11, 33.64, 37.67, 28.07, 15.09,
42.08, 32.47, 38.6, 23.01, 31.02, 27.86, 31.19, 39.48, 39.79,
31.22, 32.6, 40.19, 26.81, 35.29, 32.09, 28.72, 29.98, 30.46,
29.21, 29.34, 35.94, 41.07, 29.53, 41.62, 15.12, 34.79, 19.35,
32.93, 32.13, 25.6, 32.57, 35.48, 33.38, 24.58, 46.79, 31.48,
32.83, 25.45, 18.45, 36.61, 23.52, 36.84, 30.09, 30.26, 34.28,
37.17, 34.94, 20.66, 28.35, 25.22, 36.58, 33.19, 42.34, 34.19,
50.82, 31.01, 42.44, 18.4, 36.38, 34.8, 42.34, 42.42, 20.85,
43.25, 18.55, 44.78, 27.61, 37.62, 19.12, 43.5, 36.18, 40.5,
28.31, 44.67, 42.46, 34.72, 19.09, 23.62, 39.61, 37.61, 31.45,
34, 24.96, 42.34, 28.14, 37.94, 37.12, 39.27, 38.09, 49.29, 29.82,
30.74, 38.69, 40.52, 42.9, 44.79, 35.95, 38.26, 27.76, 35.3,
52.03, 33.72, 32.28, 39.32, 39.08, 37.47, 18.06, 22.61, 40.1,
32.5, 22.51, 39.48, 37.27, 33.2, 27.54, 23.09, 23.94, 34.22,
40.57, 28.11, 33.13, 20.33, 28.99, 31.28, 32.18, 33.11, 36.15,
39.52, 37.24, 35.18, 37.5, 38.79, 40.19, 42.63, 37.34, 44.08,
43.81, 36.88, 32.42, 38.88, 27.69, 33.44, 34.63, 37.6, 41.43,
40.32, 36.36, 38.63, 36.33, 32.08, 40.8, 41.77, 30.32, 38.79,
26.26, 22.26, 23.11, 37.9, 15.79, 29.88, 29.64, 39.54, 42.24,
21.8, 32.42, 37.99, 37.21, 36.11, 51.71, 23.49, 40.02, 42.68,
44.13, 35.01, 30.32, 47.3, 24.25, 44.32, 39.45, 26.52, 34.74,
41.14, 37.52, 44.21, 45.34, 47.01, 16.99, 29.67, 16.31, 48.67,
21.35, 41.62, 23.61, 48.6, 21.39, 28.38, 26.78, 25.09, 15.94,
16.39, 28.34, 34.32, 46.46, 42.49, 19.86, 26.92, 25.58, 38.06,
30.57, 51.33, 41.82, 17.43, 28.46, 29.97, 34.76, 27.46, 41.98,
26.29, 26.8, 17.24, 39.7, 37.8, 51.78, 40.45, 30.52, 35, 44.15,
21.42, 52.15, 33.27, 35.7, 25.26, 55.08, 21.87, 28.26, 42.21,
43.25, 40.81, 32.57, 38.46, 33.39, 41.59, 35.56, 31.49, 31.42,
36.27, 20.52, 35.03, 29.84, 32.56, 29.62, 53.26, 36.27, 33.21,
54.44, 54.88, 36.02, 33.78, 45.53, 41.4, 31.9, 45.61, 51.93,
55.99, 26.88, 43.45, 53.82, 38.02, 44.76, 43.92, 50.04, 41.6,
47.76, 22.58, 17.62, 50.74, 45.2, 56.84, 48.09, 31.51, 50.76,
17.82, 43.37, 24.66, 50.32, 19.46, 23.32, 42.51, 44.18, 40.78,
21.15, 20.74, 22.73, 15.18, 39.2, 48.03, 39.41, 38.52, 43.21,
25.51, 42.72, 37.73, 20.88, 18.94, 32.94, 27.61, 21.83, 34.76,
23.52, 36.57, 28.07, 30.09, 38.58, 42.76, 43.87, 37.67, 41.2,
39.13, 39.19, 39.52, 14.91, 38.47, 32.61, 28.45, 41.2, 44.24),
AEA = c(28.25, 27.96, 38.15, 48.97, 31.64, 29.25, 23.3, 15.62,
39.07, 47.96, 38.13, 21.47, 36.5, 30.81, 41.46, 33.89, 31.93,
29.46, 44.67, 31.07, 40.27, 36.98, 45.35, 51.1, 41.07, 24.96,
23.94, 28.9, 46.36, 29.94, 44.49, 44.48, 35.4, 49.12, 29.13,
41.23, 48.22, 48.3, 21.72, 19.72, 23.74, 44.49, 36.43, 38.2,
36.14, 38.49, 33.69, 30.61, 30.18, 43.78, 45.69, 47.72, 46.59,
39.86, 24.77, 35.97, 43.05, 25.13, 40.77, 22.64, 38.11, 11.71,
37.02, 39.92, 30.15, 33.38, 36.08, 37.06, 34.96, 15.86, 36.99,
22.72, 29.91, 23.01, 31.17, 35.27, 39.98, 41.74, 45.05, 31.55,
27.65, 45.23, 43.88, 46.64, 36.9, 36.87, 29.13, 31.93, 37.39,
24.07, 38.94, 50.03, 35.78, 47.77, 16, 39.52, 25.2, 44.55,
43.82, 25.42, 54.65, 34.93, 19.9, 29.17, 46.79, 36.55, 37.91,
19.16, 14.23, 32.48, 24.98, 45.98, 32.17, 30.17, 40.18, 39.61,
36.11, 20.66, 30.75, 25.05, 39.26, 37.65, 38.79, 35.25, 34.26,
29.85, 31.36, 17.17, 18.59, 29.44, 38.56, 44.02, 18.73, 42.73,
17.76, 36.98, 33.43, 34.97, 23.2, 50.31, 39.86, 12.49, 24.53,
56.6, 45.33, 36.07, 18.56, 23.38, 39.13, 41.67, 35.5, 36.98,
55.22, 42.89, 23.67, 39.66, 38.51, 48.93, 37.39, 42.21, 42.79,
35.73, 45.62, 34.08, 43.77, 43.31, 38.04, 36.98, 31.03, 20.58,
55.91, 34.5, 30.83, 35.85, 46.1, 43.7, 20.23, 30.74, 41.79,
35.74, 42.58, 45.04, 48.57, 33.26, 28.62, 31.72, 23.09, 44.55,
40, 30.03, 43.86, 22.84, 44.11, 42.82, 33.19, 31.09, 40,
42.11, 39.21, 36.5, 49.4, 48.06, 36.55, 42.71, 40, 38.1,
44.56, 27.05, 29.27, 40.55, 29.64, 35.7, 28.22, 17.69, 44.76,
33.69, 37.44, 38.85, 26.6, 39.13, 55.28, 41.77, 47.28, 24.88,
40.17, 26.31, 38.32, 47.15, 23.99, 29.04, 31.16, 27.36, 45.95,
42.9, 32.43, 33.89, 34.34, 33.84, 47.87, 23.98, 46.92, 31.16,
40.93, 41.33, 32.44, 51.93, 34.46, 36.2, 45.97, 32.11, 44.74,
39.76, 47.28, 39.87, 40.62, 50.47, 18.03, 19.45, 15.67, 29.17,
18.17, 39.54, 15.11, 31.63, 22.38, 36.62, 27.07, 38.75, 20.85,
24.17, 16.9, 21.79, 47.99, 29.62, 19.86, 12.29, 28.67, 35.9,
32.96, 31.3, 42.96, 11.21, 26.01, 27.08, 18.29, 16.03, 39.38,
20.72, 42.86, 25.34, 46.5, 11.99, 47.96, 48.16, 25.68, 33.31,
47.68, 38.28, 50.02, 28.6, 41.95, 27.53, 48.04, 34.85, 33.36,
26.26, 51.42, 37.95, 49.2, 47.5, 23.21, 30.26, 43.56, 41.43,
31.58, 28.61, 16.5, 42.09, 18.55, 17.79, 25.78, 24.69, 17.86,
43.71, 34.4, 22.86, 35.76, 30.66, 27.75, 22.76, 44.72, 33.96,
39.91, 43.56, 21.23, 40.58, 57.96, 45.92, 26.55, 39.85, 38.77,
28.42, 27.49, 21.97, 14.93, 44.06, 44.78, 52.96, 33.52, 37.9,
26.02, 19.51, 33.05, 11.14, 41.1, 20.67, 24.34, 43.39, 30.87,
22.9, 30.64, 18.17, 18.15, 21.13, 26.91, 50.79, 30.62, 37.64,
27.23, 21.92, 45.19, 29.66, 26.27, 29.15, 20.93, 23.27, 17.2,
46.23, 18.1, 33.77, 26.81, 21.5, 35.66, 31.15, 32.89, 40.14,
43.64, 39.79, 45.23, 36.39, 13.33, 30.48, 22.8, 17.36, 25.64,
32.28), TL = c(1611.73, 2000.03, 1708.56, 1482.78, 1930.17,
1517.96, 1645.54, 875.36, 363.9, 1211.11, 707.75, 126, 1896.33,
1201.09, 1666.03, 399.99, 899.19, 1440.9, 1220.85, 441.89,
1301.19, 411.25, 1058.35, 690.71, 468.28, 493.29, 696.64,
720.94, 937.48, 873.6, 1161.28, 1183.29, 1187.31, 1383.79,
1282.36, 1401.17, 1664.07, 1302.93, 933.67, 87.4, 93.95,
1195.63, 1438.75, 1319.66, 1418.64, 1327.36, 1144.91, 948.1,
1321.69, 762.5, 997.04, 1440.75, 1408.02, 866.92, 1246.34,
598.59, 1063.82, 1085.85, 1207.25, 134.17, 1140.67, 985.6,
322.6, 1465.07, 967.79, 1599.73, 952, 1299.05, 1393.75, 91.43,
990.4, 578.34, 1172.86, 54.6, 91.27, 303.89, 572.89, 451.17,
789.86, 486.99, 724.69, 945.37, 770.01, 781.5, 854.24, 757.08,
800.99, 1151.25, 878.57, 993.9, 1321.97, 1026.26, 1940.87,
1102.77, 119.1, 1022.64, 387.96, 733.32, 733.32, 1763.76,
1513.12, 1817.78, 1135.1, 831.09, 34.03, 1369.28, 917.96,
908.13, 683.13, 1166.54, 807.42, 1153.25, 1565.59, 150.23,
680.17, 1928.68, 1016.73, 66.74, 1112.68, 197.12, 1074.66,
1066.72, 1492.29, 1734.69, 1637.43, 989.48, 1599.23, 579.92,
719.32, 587.93, 1138.26, 1221.17, 155.19, 1725.77, 588.6,
1312.38, 313.34, 1613.8, 338.36, 1151.78, 1049.66, 581.26,
620.8, 1100.6, 903.21, 927.57, 546.59, 592.5, 1515.52, 1529.04,
989.13, 1136.83, 820.87, 1473.18, 501.83, 1297.74, 1046.32,
1561.67, 1189.51, 1509.71, 1950.75, 889.54, 1626.39, 963.38,
1104.73, 1347.17, 1233.09, 1157.94, 244.12, 844.23, 1090.23,
1261.21, 1398.66, 1598.67, 1103.24, 1434.42, 1490.93, 1162.7,
1148.45, 1617.38, 1756.51, 1556.14, 1596.56, 389.17, 962.41,
389.78, 331.44, 1434.05, 1132.93, 1162.65, 739.07, 839.96,
1356.59, 1242.56, 1274.23, 1185.76, 1553.95, 762.44, 704.39,
864.76, 751.27, 934.28, 676.79, 1327.19, 1216.19, 1323.44,
1263.23, 1029, 1365.65, 1311.42, 754.7, 1032.19, 785.28,
1059.54, 949.51, 1104.21, 1472.86, 1380.74, 488.81, 586.57,
812.65, 43.01, 971.71, 1273, 1386.87, 471.91, 1279.95, 1419.04,
746.12, 603.88, 599.53, 1193.19, 772.09, 656.75, 1269.64,
1592.46, 224.31, 1565.19, 314.17, 732.08, 797.02, 650.48,
979.58, 981.88, 1021.67, 1033.49, 615.97, 879.24, 1202.83,
891.77, 752.86, 1100.06, 1435.95, 1490.92, 1700.68, 988.49,
306.85, 1598.08, 2026.11, 1797.46, 1713.56, 1931.49, 1454.85,
1738.81, 606.43, 444.09, 205.4, 169.68, 257.38, 231.88, 400.34,
815.09, 307, 647.04, 35.05, 367.68, 311.54, 751.33, 1009.03,
935.37, 157.38, 308.69, 709.07, 388.39, 449.79, 376.5, 947.29,
118.91, 1197.86, 87.95, 332.69, 166.82, 354.31, 1606.2, 291.69,
1249.39, 242.86, 1224.76, 124.8, 1411.4, 931.46, 1235.16,
281.03, 243.04, 122.92, 1477.23, 1265.99, 611.88, 842.57,
1560.03, 750.99, 441.94, 959.78, 958.17, 839.82, 1669.83,
574.74, 1224.5, 2036.75, 611.1, 1038.6, 1270.32, 1408.93,
819.38, 1488.12, 1609.87, 2077.33, 542.6, 1224.49, 897.21,
526.17, 1255.22, 1024.2, 1094.07, 883.58, 1474.83, 254.22,
685.91, 773.99, 369.43, 1067.1, 836.8, 161.94, 195.51, 71.42,
263.71, 67.52, 199.61, 1022.58, 633.86, 383.58, 1067.64,
489.93, 537.01, 685.4, 397.12, 656.74, 81.97, 661.04, 622.34,
588.71, 840.62, 486.15, 293.62, 1457.94, 365.49, 1087.82,
914.33, 1186.08, 621.2, 1609.02, 857.75, 821.89, 704.72,
422.94, 1526.63, 1017.96, 1205.47, 776.56, 1489.03, 2100.99,
842.79, 1763.54, 1767.1, 1970.65, 126.37, 1428.01, 2166.15,
1766.8, 1556.1, 854.55, 807.59, 455.12, 542.3, 146.07, 355.4
), AL = c(322.35, 400.01, 341.71, 247.13, 386.03, 303.59,
329.11, 291.79, 90.97, 242.22, 176.94, 25.2, 379.27, 300.27,
333.21, 66.67, 149.87, 288.18, 244.17, 110.47, 260.24, 137.08,
264.59, 138.14, 156.09, 164.43, 174.16, 180.24, 187.5, 218.4,
232.26, 236.66, 237.46, 276.76, 320.59, 280.23, 332.81, 260.59,
186.73, 21.85, 23.49, 239.13, 287.75, 329.91, 354.66, 331.84,
228.98, 189.62, 440.56, 254.17, 249.26, 288.15, 352.01, 288.97,
311.58, 149.65, 212.76, 361.95, 241.45, 33.54, 285.17, 328.53,
107.53, 366.27, 193.56, 399.93, 190.4, 259.81, 278.75, 30.48,
198.08, 144.58, 293.21, 18.2, 30.42, 101.3, 143.22, 150.39,
157.97, 162.33, 181.17, 189.07, 192.5, 195.37, 213.56, 252.36,
267, 287.81, 292.86, 331.3, 440.66, 256.56, 388.17, 220.55,
29.78, 204.53, 129.32, 146.66, 146.66, 352.75, 302.62, 363.56,
227.02, 166.22, 17.02, 342.32, 183.59, 302.71, 136.63, 291.63,
269.14, 288.31, 313.12, 37.56, 226.72, 321.45, 254.18, 22.25,
222.54, 65.71, 268.67, 266.68, 298.46, 346.94, 327.49, 197.9,
319.85, 115.98, 239.77, 146.98, 284.57, 244.23, 51.73, 345.15,
117.72, 262.48, 78.33, 322.76, 84.59, 230.36, 209.93, 193.75,
124.16, 220.12, 180.64, 185.51, 109.32, 118.5, 303.1, 305.81,
197.83, 284.21, 410.44, 294.64, 100.37, 259.55, 209.26, 312.33,
237.9, 301.94, 390.15, 222.38, 325.28, 192.68, 220.95, 269.43,
246.62, 231.59, 48.82, 422.12, 218.05, 420.4, 349.66, 399.67,
220.65, 286.88, 372.73, 232.54, 229.69, 323.48, 351.3, 311.23,
319.31, 97.29, 320.8, 77.96, 82.86, 286.81, 226.59, 387.55,
184.77, 279.99, 271.32, 248.51, 318.56, 296.44, 310.79, 152.49,
234.8, 172.95, 150.25, 186.86, 169.2, 265.44, 243.24, 264.69,
315.81, 205.8, 341.41, 327.86, 188.68, 258.05, 261.76, 353.18,
237.38, 220.84, 368.21, 276.15, 162.94, 146.64, 203.16, 14.34,
194.34, 254.6, 346.72, 157.3, 213.33, 283.81, 149.22, 201.29,
199.84, 238.64, 154.42, 164.19, 253.93, 318.49, 56.08, 391.3,
104.72, 146.42, 159.4, 162.62, 195.92, 196.38, 204.33, 206.7,
153.99, 219.81, 240.57, 222.94, 188.22, 275.02, 287.19, 298.18,
340.14, 197.7, 61.37, 319.62, 337.69, 299.58, 285.59, 321.92,
242.48, 347.76, 101.07, 148.03, 68.47, 84.84, 64.34, 77.29,
133.45, 271.7, 102.33, 129.41, 17.53, 183.84, 103.85, 250.44,
252.26, 187.07, 78.69, 102.9, 354.53, 97.1, 149.93, 188.25,
189.46, 59.45, 239.57, 43.97, 110.9, 83.41, 118.1, 321.24,
97.23, 249.88, 60.71, 306.19, 41.6, 352.85, 186.29, 308.79,
93.68, 81.01, 61.46, 295.45, 253.2, 122.38, 280.86, 312.01,
375.5, 147.31, 239.95, 191.63, 209.96, 333.97, 114.95, 244.9,
407.35, 203.7, 173.1, 254.06, 234.82, 204.85, 297.62, 321.97,
415.47, 135.65, 244.9, 224.3, 175.39, 251.04, 204.84, 273.52,
176.72, 294.97, 127.11, 171.48, 154.8, 123.14, 213.42, 167.36,
53.98, 48.88, 35.71, 131.85, 33.76, 49.9, 340.86, 211.29,
191.79, 177.94, 163.31, 268.5, 137.08, 132.37, 218.91, 27.32,
132.21, 155.59, 98.12, 140.1, 97.23, 48.94, 291.59, 121.83,
217.56, 182.87, 197.68, 124.24, 321.8, 171.55, 164.38, 176.18,
140.98, 254.44, 339.32, 241.09, 129.43, 297.81, 420.2, 280.93,
352.71, 353.42, 394.13, 25.27, 285.6, 361.03, 353.36, 311.22,
170.91, 161.52, 113.78, 135.58, 73.03, 177.7), RC = c(5L,
5L, 5L, 6L, 5L, 5L, 5L, 3L, 4L, 5L, 4L, 5L, 5L, 4L, 5L, 6L,
6L, 5L, 5L, 4L, 5L, 3L, 4L, 5L, 3L, 3L, 4L, 4L, 5L, 4L, 5L,
5L, 5L, 5L, 4L, 5L, 5L, 5L, 5L, 4L, 4L, 5L, 5L, 4L, 4L, 4L,
5L, 5L, 3L, 3L, 4L, 5L, 4L, 3L, 4L, 4L, 5L, 3L, 5L, 4L, 4L,
3L, 3L, 4L, 5L, 4L, 5L, 5L, 5L, 3L, 5L, 4L, 4L, 3L, 3L, 3L,
4L, 3L, 5L, 3L, 4L, 5L, 4L, 4L, 4L, 3L, 3L, 4L, 3L, 3L, 3L,
4L, 5L, 5L, 4L, 5L, 3L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 2L, 4L,
5L, 3L, 5L, 4L, 3L, 4L, 5L, 4L, 3L, 6L, 4L, 3L, 5L, 3L, 4L,
4L, 5L, 5L, 5L, 5L, 5L, 5L, 3L, 4L, 4L, 5L, 3L, 5L, 5L, 5L,
4L, 5L, 4L, 5L, 5L, 3L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
4L, 2L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 4L, 5L, 5L, 5L, 5L,
5L, 5L, 5L, 2L, 5L, 3L, 4L, 4L, 5L, 5L, 4L, 5L, 5L, 5L, 5L,
5L, 5L, 4L, 3L, 5L, 4L, 5L, 5L, 3L, 4L, 3L, 5L, 5L, 4L, 4L,
5L, 5L, 3L, 5L, 5L, 5L, 4L, 5L, 5L, 5L, 4L, 5L, 4L, 4L, 4L,
4L, 3L, 3L, 4L, 5L, 4L, 5L, 3L, 4L, 4L, 3L, 5L, 5L, 4L, 3L,
6L, 5L, 5L, 3L, 3L, 5L, 5L, 4L, 5L, 5L, 4L, 4L, 3L, 5L, 5L,
4L, 5L, 5L, 5L, 5L, 4L, 4L, 5L, 4L, 4L, 4L, 5L, 5L, 5L, 5L,
5L, 5L, 6L, 6L, 6L, 6L, 6L, 5L, 6L, 3L, 3L, 2L, 4L, 3L, 3L,
3L, 3L, 5L, 2L, 2L, 3L, 3L, 4L, 5L, 2L, 3L, 2L, 4L, 3L, 2L,
5L, 2L, 5L, 2L, 3L, 2L, 3L, 5L, 3L, 5L, 4L, 4L, 3L, 4L, 5L,
4L, 3L, 3L, 2L, 5L, 5L, 5L, 3L, 5L, 2L, 3L, 4L, 5L, 4L, 5L,
5L, 5L, 5L, 3L, 6L, 5L, 6L, 4L, 5L, 5L, 5L, 4L, 5L, 4L, 3L,
5L, 5L, 4L, 5L, 5L, 2L, 4L, 5L, 3L, 5L, 5L, 3L, 4L, 2L, 2L,
2L, 4L, 3L, 3L, 2L, 6L, 3L, 2L, 5L, 3L, 3L, 3L, 5L, 4L, 6L,
6L, 5L, 6L, 5L, 3L, 5L, 5L, 6L, 5L, 5L, 5L, 5L, 4L, 3L, 6L,
3L, 5L, 6L, 5L, 5L, 3L, 5L, 5L, 5L, 5L, 5L, 6L, 5L, 5L, 5L,
5L, 4L, 4L, 2L, 2L), CH = c(99796.6, 150717.35, 169751.56,
138012.75, 145077.46, 112201.58, 114565.78, 29620.4, 8114.84,
104093.06, 41066.73, 382.14, 149702.87, 92373.87, 158251.21,
6220.25, 34758.22, 112415.55, 82849.16, 9090.06, 51765.37,
16842.27, 88999.49, 44639.16, 17088.07, 16880.06, 36641.48,
33244.5, 60371.65, 43912.9, 77793.71, 86013.44, 81057.21,
116609.76, 111212.8, 83104.24, 136636.59, 112152.81, 43416.08,
283.33, 374.67, 90389.3, 114615.27, 127323.54, 122751.22,
105850.82, 91786.61, 23112.34, 133294.75, 27773.3, 49075.11,
93961.22, 144848.22, 77854.05, 65839.32, 24644.95, 61791.45,
74955.5, 92759.51, 964.97, 87895.4, 21552.75, 7974, 123189.55,
56441.2, 145209.81, 47723.32, 79965.64, 102406.65, 337.25,
66525.5, 9440, 79655.87, 176.68, 730.37, 5127.66, 20335.05,
16666.69, 38090.42, 20058.33, 11775.04, 50170.86, 36106.37,
61313.49, 43396.46, 47042.07, 49551.7, 91789.19, 48686.24,
64761.22, 156197.85, 55463.72, 153143.15, 64908.28, 506.14,
56835.13, 6120.06, 21167.83, 21211.43, 87971.16, 90657.94,
171831.58, 65430.27, 17854.84, 143.88, 91421.95, 34874.29,
38881.59, 3485.86, 99421.46, 36734.34, 92497.02, 104054.94,
940.84, 30819.4, 140446.17, 73149.38, 269.12, 68028.56, 2113.16,
74108.99, 61726.85, 103843.73, 115498.2, 152778.67, 40062.47,
137124.42, 13089.39, 35384.17, 13814.31, 101758.52, 72365.21,
1278.51, 133907.82, 21664.34, 89772.79, 5596.74, 127352.18,
8147.31, 58849.79, 39310.16, 16462, 16314.24, 67631.15, 46364.97,
64883.46, 9567.38, 10933.67, 107106.85, 85896.08, 36002.96,
99832.8, 96843.38, 168697.71, 11437, 89556.61, 64397.67,
175431.79, 99090.85, 137239, 177246.87, 16387.22, 129327.61,
49607.1, 84182.02, 103011.14, 76487.65, 68888.93, 2282.16,
40631.51, 84576.92, 136079.95, 102144.36, 170229.88, 80668.54,
122418.68, 36610.94, 54793.71, 71040.25, 119430.26, 124054.15,
158980.28, 115531.49, 7677, 52408.88, 5199.15, 1576.3, 117319.45,
65816.75, 107784.21, 21943.18, 44438.61, 79339.9, 94229.06,
78243.95, 87762.86, 102039.27, 27904.08, 33803.89, 30992.8,
22984.68, 52859.31, 32240, 96533.18, 110382.23, 90531.02,
156301.06, 74191.42, 101508.11, 126192.09, 25026.39, 52022.31,
54502.27, 54906.39, 46723.31, 64956.56, 164183.81, 106144.3,
15816.24, 25480.55, 40012.96, 187.89, 28777.54, 60948.7,
111351.64, 18846.81, 44388.99, 98196.75, 13827.13, 23302.71,
23032.36, 78314.21, 43668.82, 21560.18, 81402.92, 110253.4,
2468, 161127.06, 6728.38, 24954.59, 29634.28, 19529.65, 62234.38,
77694.07, 39340.43, 67121.62, 17881.17, 53538.79, 92126.96,
27319.28, 37817.88, 83791.37, 123852.55, 119991.03, 155539.82,
59573.35, 2017.04, 65310.24, 67034.04, 85421.53, 45188.09,
142873.37, 42077.58, 118492.3, 8899.7, 12988.53, 2414.63,
748.24, 1635.91, 1649.83, 12088.91, 21986.38, 5871.28, 17082.53,
89.46, 5935.65, 4201.11, 48657.16, 60375.11, 19427.75, 3066.9,
3634.67, 56680.85, 8585.62, 10017.71, 8010.08, 38352.11,
861.56, 63114, 778.52, 6436.22, 1594.19, 11462.7, 147823.51,
3663.95, 68565.01, 3541.49, 111886, 1550, 102544.23, 46836.23,
57453.23, 7184.43, 3564.13, 827.86, 81637.61, 63919.09, 29682.26,
69984.84, 139094.03, 66276.96, 10650.41, 36945, 35774.31,
44166.05, 73627.28, 6224.87, 41446.36, 91344.8, 30789.52,
45791.66, 66309.25, 21550.8, 37335.77, 76399.5, 59260.5,
139885.86, 12678.87, 32494.66, 43462.29, 28585.93, 58488.41,
38932.21, 72211.27, 37080.1, 120925.26, 8037.65, 39036.09,
12348, 11398.33, 76742.36, 45091.44, 2286.63, 1037.5, 377.59,
5550.86, 568, 2742.84, 40443.88, 31255.25, 15853.41, 12635.68,
24472.5, 31640.11, 25472.72, 8286.29, 44970.06, 514.17, 29406,
18771.87, 11593.36, 38816.45, 3866.89, 1358.91, 67884.5,
15016.07, 39352.47, 40707.85, 67124.98, 16286.1, 118673.4,
43579.93, 31756.41, 32294.47, 11045, 56989.65, 27077.35,
63791.55, 7803.23, 83200.54, 121846.69, 50495.22, 131891.93,
129093.86, 159164.54, 753.21, 99728.86, 175305.54, 151381.78,
114235.61, 8781.88, 31090, 11269.42, 11908.07, 554.04, 4928.65
), MW = c(427L, 456L, 331L, 308L, 479L, 411L, 330L, 158L,
60L, 360L, 352L, 17L, 432L, 488L, 550L, 76L, 179L, 541L,
443L, 66L, 219L, 109L, 318L, 191L, 220L, 111L, 258L, 173L,
355L, 250L, 318L, 424L, 350L, 420L, 422L, 421L, 573L, 521L,
199L, 16L, 23L, 399L, 347L, 521L, 549L, 336L, 231L, 104L,
491L, 131L, 161L, 357L, 479L, 261L, 305L, 152L, 308L, 520L,
437L, 26L, 450L, 99L, 64L, 556L, 176L, 526L, 311L, 379L,
382L, 14L, 354L, 70L, 442L, 13L, 32L, 57L, 193L, 117L, 308L,
157L, 60L, 222L, 195L, 328L, 237L, 282L, 241L, 217L, 325L,
265L, 506L, 260L, 475L, 382L, 22L, 222L, 45L, 239L, 239L,
252L, 395L, 518L, 319L, 105L, 15L, 396L, 158L, 128L, 20L,
293L, 125L, 365L, 259L, 14L, 112L, 515L, 274L, 17L, 332L,
27L, 139L, 297L, 474L, 298L, 567L, 202L, 468L, 87L, 275L,
132L, 441L, 333L, 23L, 452L, 221L, 431L, 63L, 434L, 80L,
324L, 145L, 189L, 80L, 438L, 234L, 351L, 59L, 83L, 474L,
263L, 224L, 510L, 479L, 555L, 74L, 327L, 350L, 563L, 519L,
507L, 534L, 83L, 546L, 289L, 301L, 506L, 375L, 388L, 36L,
155L, 418L, 540L, 353L, 522L, 368L, 523L, 96L, 255L, 277L,
357L, 350L, 487L, 347L, 86L, 269L, 41L, 24L, 311L, 398L,
422L, 154L, 221L, 278L, 365L, 304L, 257L, 324L, 195L, 290L,
191L, 176L, 313L, 260L, 471L, 486L, 415L, 579L, 439L, 361L,
433L, 184L, 285L, 273L, 228L, 288L, 386L, 536L, 500L, 53L,
122L, 259L, 10L, 125L, 246L, 419L, 188L, 217L, 457L, 76L,
257L, 257L, 327L, 155L, 120L, 339L, 480L, 34L, 552L, 74L,
124L, 269L, 216L, 301L, 374L, 131L, 243L, 169L, 240L, 390L,
137L, 229L, 421L, 334L, 482L, 496L, 236L, 24L, 225L, 211L,
406L, 194L, 504L, 243L, 541L, 88L, 156L, 61L, 8L, 25L, 23L,
149L, 62L, 56L, 103L, 10L, 48L, 35L, 290L, 283L, 164L, 92L,
16L, 306L, 118L, 84L, 70L, 214L, 24L, 356L, 28L, 46L, 8L,
150L, 516L, 38L, 405L, 80L, 339L, 50L, 338L, 258L, 326L,
124L, 44L, 12L, 212L, 323L, 239L, 447L, 529L, 425L, 84L,
228L, 240L, 304L, 332L, 64L, 241L, 316L, 226L, 163L, 256L,
87L, 153L, 409L, 315L, 534L, 168L, 205L, 294L, 190L, 345L,
244L, 342L, 156L, 491L, 175L, 230L, 100L, 79L, 385L, 351L,
57L, 23L, 14L, 38L, 40L, 67L, 180L, 290L, 140L, 42L, 267L,
267L, 171L, 66L, 348L, 40L, 303L, 166L, 46L, 292L, 45L, 19L,
358L, 162L, 358L, 311L, 408L, 114L, 439L, 191L, 192L, 181L,
168L, 348L, 119L, 284L, 51L, 325L, 340L, 238L, 455L, 478L,
557L, 25L, 411L, 608L, 458L, 465L, 43L, 293L, 128L, 71L,
15L, 33L), MD = c(594L, 607L, 703L, 603L, 565L, 512L, 627L,
501L, 382L, 686L, 389L, 126L, 523L, 461L, 575L, 184L, 299L,
417L, 337L, 265L, 389L, 246L, 575L, 354L, 284L, 282L, 305L,
468L, 330L, 377L, 476L, 589L, 497L, 529L, 520L, 470L, 546L,
601L, 607L, 129L, 111L, 426L, 620L, 510L, 470L, 491L, 527L,
333L, 541L, 359L, 485L, 435L, 561L, 538L, 341L, 362L, 437L,
521L, 614L, 121L, 433L, 478L, 256L, 459L, 450L, 497L, 290L,
395L, 495L, 58L, 376L, 240L, 367L, 100L, 120L, 308L, 301L,
280L, 235L, 264L, 463L, 540L, 369L, 352L, 340L, 343L, 424L,
557L, 307L, 471L, 568L, 493L, 725L, 498L, 113L, 441L, 252L,
251L, 252L, 615L, 388L, 614L, 387L, 317L, 65L, 529L, 555L,
702L, 305L, 634L, 567L, 525L, 641L, 135L, 495L, 497L, 480L,
51L, 415L, 178L, 602L, 365L, 500L, 685L, 663L, 562L, 587L,
357L, 301L, 250L, 450L, 415L, 137L, 408L, 204L, 368L, 164L,
502L, 200L, 288L, 314L, 212L, 482L, 385L, 512L, 528L, 342L,
335L, 435L, 556L, 351L, 402L, 377L, 605L, 231L, 495L, 381L,
672L, 575L, 669L, 694L, 378L, 485L, 325L, 508L, 439L, 393L,
370L, 173L, 480L, 428L, 522L, 690L, 734L, 583L, 465L, 653L,
424L, 369L, 576L, 598L, 610L, 576L, 169L, 401L, 232L, 152L,
710L, 383L, 501L, 233L, 380L, 416L, 645L, 621L, 561L, 561L,
320L, 256L, 376L, 257L, 364L, 259L, 381L, 529L, 497L, 728L,
517L, 630L, 562L, 316L, 403L, 415L, 496L, 299L, 343L, 591L,
394L, 373L, 331L, 302L, 176L, 583L, 416L, 534L, 255L, 403L,
462L, 366L, 209L, 210L, 363L, 394L, 266L, 473L, 448L, 183L,
590L, 207L, 449L, 207L, 200L, 441L, 419L, 440L, 514L, 252L,
577L, 452L, 333L, 309L, 488L, 540L, 452L, 665L, 479L, 278L,
616L, 618L, 348L, 433L, 509L, 340L, 478L, 215L, 271L, 319L,
196L, 164L, 251L, 303L, 585L, 229L, 294L, 118L, 248L, 192L,
293L, 486L, 413L, 283L, 334L, 400L, 145L, 171L, 243L, 360L,
99L, 469L, 196L, 365L, 194L, 198L, 455L, 235L, 380L, 120L,
504L, 110L, 475L, 248L, 361L, 145L, 150L, 145L, 581L, 540L,
301L, 361L, 518L, 398L, 254L, 326L, 330L, 286L, 610L, 237L,
418L, 617L, 274L, 375L, 337L, 378L, 366L, 447L, 545L, 507L,
212L, 346L, 363L, 280L, 367L, 266L, 323L, 393L, 460L, 246L,
338L, 311L, 227L, 325L, 262L, 93L, 104L, 98L, 185L, 64L,
118L, 503L, 359L, 427L, 398L, 251L, 342L, 275L, 235L, 276L,
53L, 342L, 314L, 500L, 474L, 214L, 200L, 360L, 216L, 272L,
297L, 323L, 277L, 375L, 339L, 290L, 316L, 260L, 458L, 580L,
541L, 285L, 481L, 642L, 417L, 567L, 521L, 535L, 93L, 449L,
515L, 501L, 443L, 350L, 244L, 357L, 330L, 113L, 196L), `W/D` = c(0.72,
0.75, 0.47, 0.51, 0.85, 0.8, 0.53, 0.32, 0.16, 0.52, 0.9,
0.13, 0.83, 1.06, 0.96, 0.41, 0.6, 1.3, 1.31, 0.25, 0.56,
0.44, 0.55, 0.54, 0.77, 0.39, 0.85, 0.37, 1.08, 0.66, 0.67,
0.72, 0.7, 0.79, 0.81, 0.9, 1.05, 0.87, 0.33, 0.12, 0.21,
0.94, 0.56, 1.02, 1.17, 0.68, 0.44, 0.31, 0.91, 0.36, 0.33,
0.82, 0.85, 0.49, 0.89, 0.42, 0.7, 1, 0.71, 0.21, 1.04, 0.21,
0.25, 1.21, 0.39, 1.06, 1.07, 0.96, 0.77, 0.24, 0.94, 0.29,
1.2, 0.13, 0.27, 0.19, 0.64, 0.42, 1.31, 0.59, 0.13, 0.41,
0.53, 0.93, 0.7, 0.82, 0.57, 0.39, 1.06, 0.56, 0.89, 0.53,
0.66, 0.77, 0.19, 0.5, 0.18, 0.95, 0.95, 0.41, 1.02, 0.84,
0.82, 0.33, 0.23, 0.75, 0.28, 0.18, 0.07, 0.46, 0.22, 0.7,
0.4, 0.1, 0.23, 1.04, 0.57, 0.33, 0.8, 0.15, 0.23, 0.81,
0.95, 0.44, 0.86, 0.36, 0.8, 0.24, 0.91, 0.53, 0.98, 0.8,
0.17, 1.11, 1.08, 1.17, 0.38, 0.86, 0.4, 1.12, 0.46, 0.89,
0.17, 1.14, 0.46, 0.66, 0.17, 0.25, 1.09, 0.47, 0.64, 1.27,
1.27, 0.92, 0.32, 0.66, 0.92, 0.84, 0.9, 0.76, 0.77, 0.22,
1.13, 0.89, 0.59, 1.15, 0.95, 1.05, 0.21, 0.32, 0.98, 1.03,
0.51, 0.71, 0.63, 1.12, 0.15, 0.6, 0.75, 0.62, 0.59, 0.8,
0.6, 0.51, 0.67, 0.18, 0.16, 0.44, 1.04, 0.84, 0.66, 0.58,
0.67, 0.57, 0.49, 0.46, 0.58, 0.61, 1.13, 0.51, 0.68, 0.86,
1, 1.24, 0.92, 0.84, 0.8, 0.85, 0.57, 0.77, 0.58, 0.71, 0.66,
0.46, 0.96, 1.13, 0.91, 1.27, 0.14, 0.37, 0.86, 0.06, 0.21,
0.59, 0.78, 0.74, 0.54, 0.99, 0.21, 1.23, 1.22, 0.9, 0.39,
0.45, 0.72, 1.07, 0.19, 0.94, 0.36, 0.28, 1.3, 1.08, 0.68,
0.89, 0.3, 0.47, 0.67, 0.42, 0.86, 0.41, 0.74, 0.86, 0.62,
1.07, 0.75, 0.49, 0.09, 0.37, 0.34, 1.17, 0.45, 0.99, 0.71,
1.13, 0.41, 0.58, 0.19, 0.04, 0.15, 0.09, 0.49, 0.11, 0.24,
0.35, 0.08, 0.19, 0.18, 0.99, 0.58, 0.4, 0.33, 0.05, 0.76,
0.81, 0.49, 0.29, 0.59, 0.24, 0.76, 0.14, 0.13, 0.04, 0.76,
1.13, 0.16, 1.07, 0.67, 0.67, 0.45, 0.71, 1.04, 0.9, 0.86,
0.29, 0.08, 0.36, 0.6, 0.79, 1.24, 1.02, 1.07, 0.33, 0.7,
0.73, 1.06, 0.54, 0.27, 0.58, 0.51, 0.82, 0.43, 0.76, 0.23,
0.42, 0.91, 0.58, 1.05, 0.79, 0.59, 0.81, 0.68, 0.94, 0.92,
1.06, 0.4, 1.07, 0.71, 0.68, 0.32, 0.35, 1.18, 1.34, 0.61,
0.22, 0.14, 0.21, 0.62, 0.57, 0.36, 0.81, 0.33, 0.11, 1.06,
0.78, 0.62, 0.28, 1.26, 0.75, 0.89, 0.53, 0.09, 0.62, 0.21,
0.1, 0.99, 0.75, 1.32, 1.05, 1.26, 0.41, 1.17, 0.56, 0.66,
0.57, 0.65, 0.76, 0.21, 0.52, 0.18, 0.68, 0.53, 0.57, 0.8,
0.92, 1.04, 0.27, 0.92, 1.18, 0.91, 1.05, 0.12, 1.2, 0.36,
0.22, 0.13, 0.17)), .Names = c("ATA", "AEA", "TL", "AL",
"RC", "CH", "MW", "MD", "W/D"), row.names = c(NA, -396L), class =
c("tbl_df",
"tbl", "data.frame"))
我尝试用ggcorr函数执行此操作,最后得到了一个图表,我很高兴。但我不明白为什么它会避免&#34;避免&#34;做W / D和其他变量之间的相关性。
这是我运行的功能:
ggcorr(df,label = TRUE,name = "Spearman correlation coeff. (ρ)",
label_size = 3, hjust = 0.75, size = 5, color = "grey40", low = "#3399FF",
mid = "#FFFF66", high = "#CC0033", method = c("pairwise", "spearman"))+
theme(legend.title = element_text(size = 11))
我收到了这条警告信息:
Warning messages:
1: Removed 8 rows containing missing values (geom_tile).
2: Removed 8 rows containing missing values (geom_text).
它似乎消除了W / D与所有其他变量之间的相互关系。我认为问题出在W / D的最后一栏。
答案 0 :(得分:0)
感谢您的更新。下次,我建议您还包括您加载的库。无论如何,这是完全可重现的解决方案,我在我的机器上成功运行,没有任何错误。看看我安装的软件包版本是sessionInfo()
。也许尝试对加载的两个包执行install.packages()
,看看在更新到最新版本后是否仍然会出现相同的错误。我的第一个猜测是你错过了值,但正如你可以看到colSums(is.na(df))
我检查了任何列中是否有任何缺失值,但没有。
这就是我在下面得到这个完全可重复的例子的方法(我刚刚删除了df
部分,因为它太长了,你已经在问题中有了它):
library(reprex); reprex(venue='so', si=TRUE)
library(ggplot2)
library(GGally)
#> Warning: package 'GGally' was built under R version 3.4.1
ggcorr(df,label = TRUE,name = "Spearman correlation coeff. (ρ)",
label_size = 3, hjust = 0.75, size = 5, color = "grey40", low = "#3399FF",
mid = "#FFFF66", high = "#CC0033", method = c("pairwise", "spearman"))+
theme(legend.title = element_text(size = 11))
colSums(is.na(df))
#> ATA AEA TL AL RC CH MW MD W/D
#> 0 0 0 0 0 0 0 0 0
devtools::session_info()
#> Warning in as.POSIXlt.POSIXct(Sys.time()): unknown timezone 'default/
#> America/Vancouver'
#> Session info -------------------------------------------------------------
#> setting value
#> version R version 3.4.0 (2017-04-21)
#> system x86_64, darwin15.6.0
#> ui X11
#> language (EN)
#> collate en_US.UTF-8
#> tz <NA>
#> date 2017-09-26
#> Packages -----------------------------------------------------------------
#> package * version date source
#> backports 1.1.0 2017-05-22 CRAN (R 3.4.0)
#> base * 3.4.0 2017-04-21 local
#> colorspace 1.3-2 2016-12-14 CRAN (R 3.4.0)
#> compiler 3.4.0 2017-04-21 local
#> datasets * 3.4.0 2017-04-21 local
#> devtools 1.13.3 2017-08-02 CRAN (R 3.4.1)
#> digest 0.6.12 2017-01-27 CRAN (R 3.4.0)
#> evaluate 0.10.1 2017-06-24 CRAN (R 3.4.1)
#> GGally * 1.3.2 2017-08-02 CRAN (R 3.4.1)
#> ggplot2 * 2.2.1 2016-12-30 CRAN (R 3.4.0)
#> graphics * 3.4.0 2017-04-21 local
#> grDevices * 3.4.0 2017-04-21 local
#> grid 3.4.0 2017-04-21 local
#> gtable 0.2.0 2016-02-26 CRAN (R 3.4.0)
#> htmltools 0.3.6 2017-04-28 CRAN (R 3.4.0)
#> knitr 1.17 2017-08-10 CRAN (R 3.4.1)
#> labeling 0.3 2014-08-23 CRAN (R 3.4.0)
#> lazyeval 0.2.0 2016-06-12 CRAN (R 3.4.0)
#> magrittr 1.5 2014-11-22 CRAN (R 3.4.0)
#> memoise 1.1.0 2017-04-21 CRAN (R 3.4.0)
#> methods * 3.4.0 2017-04-21 local
#> munsell 0.4.3 2016-02-13 CRAN (R 3.4.0)
#> plyr 1.8.4 2016-06-08 CRAN (R 3.4.0)
#> RColorBrewer 1.1-2 2014-12-07 CRAN (R 3.4.0)
#> Rcpp 0.12.12 2017-07-15 cran (@0.12.12)
#> reshape 0.8.7 2017-08-06 CRAN (R 3.4.1)
#> rlang 0.1.2 2017-08-09 CRAN (R 3.4.1)
#> rmarkdown 1.6 2017-06-15 CRAN (R 3.4.0)
#> rprojroot 1.2 2017-01-16 CRAN (R 3.4.0)
#> scales 0.5.0 2017-08-24 CRAN (R 3.4.1)
#> stats * 3.4.0 2017-04-21 local
#> stringi 1.1.5 2017-04-07 CRAN (R 3.4.0)
#> stringr 1.2.0 2017-02-18 CRAN (R 3.4.0)
#> tibble 1.3.4 2017-08-22 CRAN (R 3.4.1)
#> tools 3.4.0 2017-04-21 local
#> utils * 3.4.0 2017-04-21 local
#> withr 2.0.0 2017-07-28 CRAN (R 3.4.1)
#> yaml 2.1.14 2016-11-12 CRAN (R 3.4.0)