Проблемы с преобразованием данных в матрицу после запуска lapply ()

Antsushi спросил: 13 октября 2017 в 06:28 в: r

Я использую следующий бит кода для загрузки данных в R:

    filelist <- list.files(pattern = "^KB.*.txt")
sorted <- mixedsort(sort(filelist))
#sorts the data in numerical order (i.e. c1-c11, fixed)
data_list = lapply(sorted, read.table, sep = "") 
#loads all the .txt files into R

Это вывод отсортированного

[1] "KB_5223_LLM1_rotated_1.jpg_c1.txt"   
 [2] "KB_5223_LLM1_rotated_1.jpg_c2.txt"   
 [3] "KB_5223_LLM1_rotated_1.jpg_c3.txt"   
 [4] "KB_5223_LLM1_rotated_1.jpg_c4.txt"   
 [5] "KB_5223_LLM1_rotated_1.jpg_c5.txt"   
 [6] "KB_5223_LLM1_rotated_1.jpg_c6.txt"   
 [7] "KB_5223_LLM1_rotated_1.jpg_c7.txt"   
 [8] "KB_5223_LLM1_rotated_1.jpg_c8.txt"   
 [9] "KB_5223_LLM1_rotated_1.jpg_c9.txt"   
[10] "KB_5223_LLM1_rotated_1.jpg_c10.txt"  
[11] "KB_5223_LLM1_rotated_1.jpg_c11.txt"  
[12] "KB_5223_LLM1_rotated_1.jpg_fixed.txt"

Тем не менее, данные выглядят так (это только 2 из 12 таблиц, поскольку данные очень большие)

[[10]]
         V1     V2
1   12.1153 6.3112
2   12.0841 6.2956
3   12.0529 6.2800
4   12.0217 6.2644
5   11.9906 6.2488
6   11.9595 6.2332
7   11.9285 6.2176
8   11.8976 6.2019
9   11.8668 6.1862
10  11.8362 6.1705
11  11.8056 6.1547
12  11.7753 6.1389
13  11.7451 6.1231
14  11.7151 6.1071
15  11.6854 6.0912
16  11.6558 6.0751
17  11.6265 6.0590
18  11.5974 6.0428
19  11.5686 6.0266
20  11.5401 6.0103
21  11.5118 5.9940
22  11.4837 5.9776
23  11.4558 5.9613
24  11.4282 5.9450
25  11.4008 5.9288
26  11.3736 5.9127
27  11.3465 5.8966
28  11.3197 5.8807
29  11.2930 5.8649
30  11.2664 5.8493
31  11.2400 5.8338
32  11.2138 5.8186
33  11.1877 5.8036
34  11.1617 5.7888
35  11.1358 5.7741
36  11.1101 5.7596
37  11.0844 5.7450
38  11.0588 5.7305
39  11.0334 5.7158
40  11.0080 5.7009
41  10.9827 5.6857
42  10.9574 5.6702
43  10.9323 5.6542
44  10.9071 5.6378
45  10.8821 5.6208
46  10.8570 5.6031
47  10.8320 5.5848
48  10.8071 5.5657
49  10.7822 5.5458
50  10.7572 5.5252
51  10.7323 5.5041
52  10.7074 5.4824
53  10.6825 5.4604
54  10.6576 5.4380
55  10.6327 5.4154
56  10.6077 5.3927
57  10.5827 5.3699
58  10.5577 5.3472
59  10.5326 5.3246
60  10.5075 5.3022
61  10.4823 5.2801
62  10.4570 5.2584
63  10.4317 5.2372
64  10.4063 5.2166
65  10.3808 5.1966
66  10.3552 5.1772
67  10.3296 5.1583
68  10.3039 5.1401
69  10.2781 5.1224
70  10.2523 5.1053
71  10.2264 5.0887
72  10.2004 5.0726
73  10.1744 5.0571
74  10.1484 5.0421
75  10.1223 5.0275
76  10.0961 5.0135
77  10.0699 4.9999
78  10.0437 4.9868
79  10.0175 4.9741
80   9.9912 4.9619
81   9.9648 4.9500
82   9.9383 4.9385
83   9.9116 4.9272
84   9.8847 4.9163
85   9.8575 4.9055
86   9.8301 4.8950
87   9.8023 4.8846
88   9.7741 4.8743
89   9.7456 4.8640
90   9.7166 4.8538
91   9.6871 4.8436
92   9.6571 4.8334
93   9.6265 4.8230
94   9.5953 4.8126
95   9.5636 4.8021
96   9.5314 4.7916
97   9.4988 4.7813
98   9.4658 4.7711
99   9.4324 4.7611
100  9.3987 4.7513
101  9.3648 4.7420
102  9.3307 4.7330
103  9.2965 4.7245
104  9.2621 4.7166
105  9.2277 4.7092
106  9.1933 4.7025
107  9.1589 4.6966
108  9.1246 4.6914
109  9.0905 4.6871
110  9.0566 4.6837
111  9.0228 4.6812
112  8.9892 4.6795
113  8.9558 4.6784
114  8.9225 4.6778
115  8.8893 4.6777
116  8.8561 4.6778
117  8.8230 4.6780
118  8.7898 4.6783
119  8.7567 4.6785
120  8.7234 4.6784
121  8.6901 4.6780
122  8.6567 4.6772
123  8.6232 4.6757
124  8.5894 4.6735
125  8.5555 4.6705
126  8.5214 4.6665
127  8.4870 4.6615
128  8.4525 4.6556
129  8.4178 4.6488
130  8.3831 4.6414
131  8.3484 4.6332
132  8.3138 4.6246
133  8.2793 4.6156
134  8.2450 4.6062
135  8.2110 4.5966
136  8.1772 4.5868
137  8.1438 4.5770
138  8.1109 4.5673
139  8.0784 4.5578
140  8.0465 4.5486
141  8.0152 4.5397
142  7.9845 4.5313
143  7.9546 4.5234
144  7.9253 4.5161
145  7.8965 4.5093
146  7.8681 4.5028
147  7.8398 4.4966
148  7.8116 4.4906
149  7.7832 4.4846
150  7.7546 4.4786
151  7.7256 4.4724
152  7.6959 4.4661
153  7.6655 4.4594
154  7.6343 4.4522
155  7.6019 4.4446
156  7.5684 4.4363
157  7.5334 4.4273
158  7.4970 4.4175
159  7.4590 4.4068
160  7.4195 4.3954
161  7.3785 4.3831
162  7.3362 4.3702
163  7.2926 4.3565
164  7.2477 4.3421
165  7.2017 4.3271
166  7.1545 4.3115
167  7.1063 4.2953
168  7.0571 4.2786
169  7.0069 4.2614
170  6.9558 4.2437
171  6.9040 4.2255
172  6.8514 4.2070
173  6.7981 4.1881
174  6.7442 4.1688
175  6.6897 4.1493
176  6.6347 4.1295
177  6.5793 4.1094
178  6.5236 4.0892
179  6.4675 4.0687
180  6.4111 4.0482
181  6.3546 4.0275
182  6.2979 4.0068
183  6.2412 3.9860[[11]]
         V1     V2
1   12.1153 6.3112
2   12.1376 6.2977
3   12.1599 6.2842
4   12.1821 6.2705
5   12.2041 6.2567
6   12.2259 6.2426
7   12.2476 6.2281
8   12.2689 6.2133
9   12.2900 6.1980
10  12.3107 6.1822
11  12.3309 6.1658
12  12.3508 6.1488
13  12.3701 6.1311
14  12.3889 6.1125
15  12.4071 6.0932
16  12.4247 6.0729
17  12.4416 6.0517
18  12.4578 6.0295
19  12.4734 6.0064
20  12.4885 5.9825
21  12.5030 5.9579
22  12.5170 5.9326
23  12.5305 5.9067
24  12.5437 5.8802
25  12.5565 5.8533
26  12.5689 5.8260
27  12.5811 5.7983
28  12.5930 5.7703
29  12.6047 5.7421
30  12.6163 5.7138
31  12.6278 5.6855
32  12.6391 5.6571
33  12.6505 5.6287
34  12.6618 5.6006
35  12.6732 5.5725
36  12.6846 5.5447
37  12.6961 5.5170
38  12.7077 5.4895
39  12.7194 5.4622
40  12.7311 5.4351
41  12.7430 5.4082
42  12.7550 5.3815
43  12.7671 5.3551
44  12.7794 5.3288
45  12.7918 5.3028
46  12.8044 5.2769
47  12.8172 5.2513
48  12.8302 5.2260
49  12.8434 5.2008
50  12.8568 5.1760
51  12.8704 5.1513
52  12.8843 5.1269
53  12.8983 5.1027
54  12.9126 5.0787
55  12.9270 5.0547
56  12.9415 5.0308
57  12.9561 5.0068
58  12.9709 4.9828
59  12.9856 4.9587
60  13.0004 4.9344
61  13.0152 4.9099
62  13.0300 4.8851
63  13.0447 4.8601
64  13.0593 4.8346
65  13.0739 4.8088
66  13.0883 4.7825
67  13.1025 4.7557
68  13.1166 4.7283
69  13.1305 4.7003
70  13.1442 4.6719
71  13.1576 4.6430
72  13.1709 4.6137
73  13.1840 4.5842
74  13.1969 4.5544
75  13.2096 4.5244
76  13.2221 4.4943
77  13.2344 4.4642
78  13.2465 4.4341
79  13.2584 4.4041
80  13.2702 4.3743
81  13.2817 4.3447
82  13.2930 4.3154
83  13.3042 4.2864
84  13.3151 4.2579
85  13.3259 4.2299
86  13.3365 4.2025
87  13.3469 4.1757
88  13.3571 4.1494
89  13.3671 4.1238
90  13.3769 4.0986
91  13.3866 4.0739
92  13.3961 4.0495
93  13.4055 4.0255
94  13.4147 4.0018
95  13.4237 3.9783
96  13.4326 3.9550
97  13.4414 3.9318
98  13.4501 3.9087
99  13.4586 3.8856
100 13.4670 3.8624
101 13.4753 3.8391
102 13.4834 3.8157
103 13.4916 3.7920
104 13.4996 3.7681
105 13.5077 3.7438
106 13.5159 3.7191
107 13.5242 3.6940
108 13.5326 3.6682
109 13.5413 3.6419
110 13.5503 3.6148
111 13.5595 3.5870
112 13.5691 3.5584
113 13.5792 3.5289
114 13.5897 3.4984
115 13.6007 3.4669
116 13.6123 3.4343
117 13.6245 3.4006
118 13.6373 3.3656
119 13.6509 3.3293
120 13.6652 3.2917
121 13.6803 3.2527
122 13.6961 3.2124
123 13.7126 3.1708
124 13.7297 3.1280
125 13.7476 3.0841
126 13.7661 3.0390
127 13.7852 2.9928
128 13.8049 2.9455
129 13.8251 2.8972
130 13.8459 2.8480
131 13.8673 2.7978
132 13.8891 2.7467
133 13.9114 2.6947
134 13.9342 2.6419
135 13.9574 2.5884
136 13.9810 2.5341
137 14.0050 2.4791
138 14.0293 2.4235
139 14.0540 2.3672
140 14.0791 2.3104
141 14.1044 2.2531
142 14.1300 2.1953
143 14.1558 2.1370
144 14.1819 2.0783
145 14.2081 2.0192
146 14.2346 1.9598
147 14.2612 1.9002
148 14.2880 1.8403
149 14.3148 1.7801
150 14.3418 1.7199
151 14.3688 1.6595
152 14.3959 1.5990
153 14.4230 1.5385

после загрузки, но мне нужно, чтобы это было матрица и выглядит как

             V1     V2
  [1,] 12.1153 6.3112
  [2,] 12.0841 6.2956
  [3,] 12.0529 6.2800
  [4,] 12.0217 6.2644
  [5,] 11.9906 6.2488
  [6,] 11.9595 6.2332
  [7,] 11.9285 6.2176
  [8,] 11.8976 6.2019
  [9,] 11.8668 6.1862
 [10,] 11.8362 6.1705
 [11,] 11.8056 6.1547
 [12,] 11.7753 6.1389
 [13,] 11.7451 6.1231
 [14,] 11.7151 6.1071
 [15,] 11.6854 6.0912
 [16,] 11.6558 6.0751
 [17,] 11.6265 6.0590
 [18,] 11.5974 6.0428
 [19,] 11.5686 6.0266
 [20,] 11.5401 6.0103
 [21,] 11.5118 5.9940
 [22,] 11.4837 5.9776
 [23,] 11.4558 5.9613
 [24,] 11.4282 5.9450
 [25,] 11.4008 5.9288
 [26,] 11.3736 5.9127
 [27,] 11.3465 5.8966
 [28,] 11.3197 5.8807
 [29,] 11.2930 5.8649
 [30,] 11.2664 5.8493
 [31,] 11.2400 5.8338
 [32,] 11.2138 5.8186
 [33,] 11.1877 5.8036
 [34,] 11.1617 5.7888
 [35,] 11.1358 5.7741
 [36,] 11.1101 5.7596
 [37,] 11.0844 5.7450
 [38,] 11.0588 5.7305
 [39,] 11.0334 5.7158
 [40,] 11.0080 5.7009
 [41,] 10.9827 5.6857
 [42,] 10.9574 5.6702
 [43,] 10.9323 5.6542
 [44,] 10.9071 5.6378
 [45,] 10.8821 5.6208
 [46,] 10.8570 5.6031
 [47,] 10.8320 5.5848
 [48,] 10.8071 5.5657
 [49,] 10.7822 5.5458
 [50,] 10.7572 5.5252
 [51,] 10.7323 5.5041
 [52,] 10.7074 5.4824
 [53,] 10.6825 5.4604
 [54,] 10.6576 5.4380
 [55,] 10.6327 5.4154
 [56,] 10.6077 5.3927
 [57,] 10.5827 5.3699
 [58,] 10.5577 5.3472
 [59,] 10.5326 5.3246
 [60,] 10.5075 5.3022
 [61,] 10.4823 5.2801
 [62,] 10.4570 5.2584
 [63,] 10.4317 5.2372
 [64,] 10.4063 5.2166
 [65,] 10.3808 5.1966
 [66,] 10.3552 5.1772
 [67,] 10.3296 5.1583
 [68,] 10.3039 5.1401
 [69,] 10.2781 5.1224
 [70,] 10.2523 5.1053
 [71,] 10.2264 5.0887
 [72,] 10.2004 5.0726
 [73,] 10.1744 5.0571
 [74,] 10.1484 5.0421
 [75,] 10.1223 5.0275
 [76,] 10.0961 5.0135
 [77,] 10.0699 4.9999
 [78,] 10.0437 4.9868
 [79,] 10.0175 4.9741
 [80,]  9.9912 4.9619
 [81,]  9.9648 4.9500
 [82,]  9.9383 4.9385
 [83,]  9.9116 4.9272
 [84,]  9.8847 4.9163
 [85,]  9.8575 4.9055
 [86,]  9.8301 4.8950
 [87,]  9.8023 4.8846
 [88,]  9.7741 4.8743
 [89,]  9.7456 4.8640
 [90,]  9.7166 4.8538
 [91,]  9.6871 4.8436
 [92,]  9.6571 4.8334
 [93,]  9.6265 4.8230
 [94,]  9.5953 4.8126
 [95,]  9.5636 4.8021
 [96,]  9.5314 4.7916
 [97,]  9.4988 4.7813
 [98,]  9.4658 4.7711
 [99,]  9.4324 4.7611
[100,]  9.3987 4.7513
[101,]  9.3648 4.7420
[102,]  9.3307 4.7330
[103,]  9.2965 4.7245
[104,]  9.2621 4.7166
[105,]  9.2277 4.7092
[106,]  9.1933 4.7025
[107,]  9.1589 4.6966
[108,]  9.1246 4.6914
[109,]  9.0905 4.6871
[110,]  9.0566 4.6837
[111,]  9.0228 4.6812
[112,]  8.9892 4.6795
[113,]  8.9558 4.6784
[114,]  8.9225 4.6778
[115,]  8.8893 4.6777
[116,]  8.8561 4.6778
[117,]  8.8230 4.6780
[118,]  8.7898 4.6783
[119,]  8.7567 4.6785
[120,]  8.7234 4.6784
[121,]  8.6901 4.6780
[122,]  8.6567 4.6772
[123,]  8.6232 4.6757
[124,]  8.5894 4.6735
[125,]  8.5555 4.6705
[126,]  8.5214 4.6665
[127,]  8.4870 4.6615
[128,]  8.4525 4.6556
[129,]  8.4178 4.6488
[130,]  8.3831 4.6414
[131,]  8.3484 4.6332
[132,]  8.3138 4.6246
[133,]  8.2793 4.6156
[134,]  8.2450 4.6062
[135,]  8.2110 4.5966
[136,]  8.1772 4.5868
[137,]  8.1438 4.5770
[138,]  8.1109 4.5673
[139,]  8.0784 4.5578
[140,]  8.0465 4.5486
[141,]  8.0152 4.5397
[142,]  7.9845 4.5313
[143,]  7.9546 4.5234
[144,]  7.9253 4.5161
[145,]  7.8965 4.5093
[146,]  7.8681 4.5028
[147,]  7.8398 4.4966
[148,]  7.8116 4.4906
[149,]  7.7832 4.4846
[150,]  7.7546 4.4786
[151,]  7.7256 4.4724
[152,]  7.6959 4.4661
[153,]  7.6655 4.4594
[154,]  7.6343 4.4522
[155,]  7.6019 4.4446
[156,]  7.5684 4.4363
[157,]  7.5334 4.4273
[158,]  7.4970 4.4175
[159,]  7.4590 4.4068
[160,]  7.4195 4.3954
[161,]  7.3785 4.3831
[162,]  7.3362 4.3702
[163,]  7.2926 4.3565
[164,]  7.2477 4.3421
[165,]  7.2017 4.3271
[166,]  7.1545 4.3115
[167,]  7.1063 4.2953
[168,]  7.0571 4.2786
[169,]  7.0069 4.2614
[170,]  6.9558 4.2437
[171,]  6.9040 4.2255
[172,]  6.8514 4.2070
[173,]  6.7981 4.1881
[174,]  6.7442 4.1688
[175,]  6.6897 4.1493
[176,]  6.6347 4.1295
[177,]  6.5793 4.1094
[178,]  6.5236 4.0892
[179,]  6.4675 4.0687
[180,]  6.4111 4.0482
[181,]  6.3546 4.0275
[182,]  6.2979 4.0068
[183,]  6.2412 3.9860          V1     V2
  [1,] 12.1153 6.3112
  [2,] 12.1376 6.2977
  [3,] 12.1599 6.2842
  [4,] 12.1821 6.2705
  [5,] 12.2041 6.2567
  [6,] 12.2259 6.2426
  [7,] 12.2476 6.2281
  [8,] 12.2689 6.2133
  [9,] 12.2900 6.1980
 [10,] 12.3107 6.1822
 [11,] 12.3309 6.1658
 [12,] 12.3508 6.1488
 [13,] 12.3701 6.1311
 [14,] 12.3889 6.1125
 [15,] 12.4071 6.0932
 [16,] 12.4247 6.0729
 [17,] 12.4416 6.0517
 [18,] 12.4578 6.0295
 [19,] 12.4734 6.0064
 [20,] 12.4885 5.9825
 [21,] 12.5030 5.9579
 [22,] 12.5170 5.9326
 [23,] 12.5305 5.9067
 [24,] 12.5437 5.8802
 [25,] 12.5565 5.8533
 [26,] 12.5689 5.8260
 [27,] 12.5811 5.7983
 [28,] 12.5930 5.7703
 [29,] 12.6047 5.7421
 [30,] 12.6163 5.7138
 [31,] 12.6278 5.6855
 [32,] 12.6391 5.6571
 [33,] 12.6505 5.6287
 [34,] 12.6618 5.6006
 [35,] 12.6732 5.5725
 [36,] 12.6846 5.5447
 [37,] 12.6961 5.5170
 [38,] 12.7077 5.4895
 [39,] 12.7194 5.4622
 [40,] 12.7311 5.4351
 [41,] 12.7430 5.4082
 [42,] 12.7550 5.3815
 [43,] 12.7671 5.3551
 [44,] 12.7794 5.3288
 [45,] 12.7918 5.3028
 [46,] 12.8044 5.2769
 [47,] 12.8172 5.2513
 [48,] 12.8302 5.2260
 [49,] 12.8434 5.2008
 [50,] 12.8568 5.1760
 [51,] 12.8704 5.1513
 [52,] 12.8843 5.1269
 [53,] 12.8983 5.1027
 [54,] 12.9126 5.0787
 [55,] 12.9270 5.0547
 [56,] 12.9415 5.0308
 [57,] 12.9561 5.0068
 [58,] 12.9709 4.9828
 [59,] 12.9856 4.9587
 [60,] 13.0004 4.9344
 [61,] 13.0152 4.9099
 [62,] 13.0300 4.8851
 [63,] 13.0447 4.8601
 [64,] 13.0593 4.8346
 [65,] 13.0739 4.8088
 [66,] 13.0883 4.7825
 [67,] 13.1025 4.7557
 [68,] 13.1166 4.7283
 [69,] 13.1305 4.7003
 [70,] 13.1442 4.6719
 [71,] 13.1576 4.6430
 [72,] 13.1709 4.6137
 [73,] 13.1840 4.5842
 [74,] 13.1969 4.5544
 [75,] 13.2096 4.5244
 [76,] 13.2221 4.4943
 [77,] 13.2344 4.4642
 [78,] 13.2465 4.4341
 [79,] 13.2584 4.4041
 [80,] 13.2702 4.3743
 [81,] 13.2817 4.3447
 [82,] 13.2930 4.3154
 [83,] 13.3042 4.2864
 [84,] 13.3151 4.2579
 [85,] 13.3259 4.2299
 [86,] 13.3365 4.2025
 [87,] 13.3469 4.1757
 [88,] 13.3571 4.1494
 [89,] 13.3671 4.1238
 [90,] 13.3769 4.0986
 [91,] 13.3866 4.0739
 [92,] 13.3961 4.0495
 [93,] 13.4055 4.0255
 [94,] 13.4147 4.0018
 [95,] 13.4237 3.9783
 [96,] 13.4326 3.9550
 [97,] 13.4414 3.9318
 [98,] 13.4501 3.9087
 [99,] 13.4586 3.8856
[100,] 13.4670 3.8624
[101,] 13.4753 3.8391
[102,] 13.4834 3.8157
[103,] 13.4916 3.7920
[104,] 13.4996 3.7681
[105,] 13.5077 3.7438
[106,] 13.5159 3.7191
[107,] 13.5242 3.6940
[108,] 13.5326 3.6682
[109,] 13.5413 3.6419
[110,] 13.5503 3.6148
[111,] 13.5595 3.5870
[112,] 13.5691 3.5584
[113,] 13.5792 3.5289
[114,] 13.5897 3.4984
[115,] 13.6007 3.4669
[116,] 13.6123 3.4343
[117,] 13.6245 3.4006
[118,] 13.6373 3.3656
[119,] 13.6509 3.3293
[120,] 13.6652 3.2917
[121,] 13.6803 3.2527
[122,] 13.6961 3.2124
[123,] 13.7126 3.1708
[124,] 13.7297 3.1280
[125,] 13.7476 3.0841
[126,] 13.7661 3.0390
[127,] 13.7852 2.9928
[128,] 13.8049 2.9455
[129,] 13.8251 2.8972
[130,] 13.8459 2.8480
[131,] 13.8673 2.7978
[132,] 13.8891 2.7467
[133,] 13.9114 2.6947
[134,] 13.9342 2.6419
[135,] 13.9574 2.5884
[136,] 13.9810 2.5341
[137,] 14.0050 2.4791
[138,] 14.0293 2.4235
[139,] 14.0540 2.3672
[140,] 14.0791 2.3104
[141,] 14.1044 2.2531
[142,] 14.1300 2.1953
[143,] 14.1558 2.1370
[144,] 14.1819 2.0783
[145,] 14.2081 2.0192
[146,] 14.2346 1.9598
[147,] 14.2612 1.9002
[148,] 14.2880 1.8403
[149,] 14.3148 1.7801
[150,] 14.3418 1.7199
[151,] 14.3688 1.6595
[152,] 14.3959 1.5990
[153,] 14.4230 1.5385

Мне известна функция as.matrix(read.land()) и простая функция as.matrix(), но я не могу ее получить работать над моим data_list. Я чувствую, что это может произойти из-за того, что я не совсем понимаю, что именно делает lapply() и какие данные он производит.

Я был бы благодарен за любую помощь.

Спасибо.

0 ответов