在计算时的错误()' dplyr :: summarize()':问题……由' sort.int()'::! x必须是原子
系统规格(在HPC远程群集上运行,所以我无法更新r):
R version 3.6.0 (2019-04-26) -- "Planting of a Tree"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-conda_cos6-linux-gnu (64-bit)
软件包规格:
> packageVersion("dplyr")
[1] ‘1.0.8’
数据框架标题test_profile
:
obs_idx | int | min | max | max |
---|---|---|---|---|
obs001 | “ all” | --0.255 | 1.255 1.242 | 2.487 |
obs001 obs001 | “(0.901”(0.901 ,50.5]“ | -0.255 | 0.614 | 1.554 |
obs001 | ”(50.5,100]” | 1.196 | 1.870 | 2.487 |
obs002 | “ all” |
这是易于复制的第一个99个观测值:
structure(list(obs_idx = c("Obs001", "Obs001", "Obs001", "Obs002",
"Obs002", "Obs002", "Obs003", "Obs003", "Obs003", "Obs004", "Obs004",
"Obs004", "Obs005", "Obs005", "Obs005", "Obs006", "Obs006", "Obs006",
"Obs007", "Obs007", "Obs007", "Obs008", "Obs008", "Obs008", "Obs009",
"Obs009", "Obs009", "Obs010", "Obs010", "Obs010", "Obs011", "Obs011",
"Obs011", "Obs012", "Obs012", "Obs012", "Obs013", "Obs013", "Obs013",
"Obs014", "Obs014", "Obs014", "Obs015", "Obs015", "Obs015", "Obs016",
"Obs016", "Obs016", "Obs017", "Obs017", "Obs017", "Obs018", "Obs018",
"Obs018", "Obs019", "Obs019", "Obs019", "Obs020", "Obs020", "Obs020",
"Obs021", "Obs021", "Obs021", "Obs022", "Obs022", "Obs022", "Obs023",
"Obs023", "Obs023", "Obs024", "Obs024", "Obs024", "Obs025", "Obs025",
"Obs025", "Obs026", "Obs026", "Obs026", "Obs027", "Obs027", "Obs027",
"Obs028", "Obs028", "Obs028", "Obs029", "Obs029", "Obs029", "Obs030",
"Obs030", "Obs030", "Obs031", "Obs031", "Obs031", "Obs032", "Obs032",
"Obs032", "Obs033", "Obs033", "Obs033"), min_value = c(-0.254732152867833,
-0.254732152867833, 1.19606657841744, -0.581624397177908, -0.581624397177908,
1.80285883686985, -1.32946116207892, -1.32946116207892, 0.0397515430616804,
-1.86782725237575, -1.86782725237575, -0.363677468244763, -0.89468513981088,
-0.89468513981088, 1.40224930998449, -0.182123025952034, -0.182123025952034,
1.79700463006594, 0.0628927848954747, 0.0628927848954747, 1.25094254311538,
-0.785768279069217, -0.785768279069217, 2.50315849464015, -0.267794081133244,
-0.267794081133244, 1.31447315059208, -7.30734890513561, -7.30734890513561,
-5.44985046139385, -1.70676638151362, -1.70676638151362, 0.175432359720823,
1.15535062309171, 1.15535062309171, 4.00718195291599, 0.74803703859959,
0.74803703859959, 2.41171554637094, -0.544609618466537, -0.544609618466537,
0.821409713157584, -0.366926578002299, -0.366926578002299, 0.861453880987911,
-6.88501280669894, -6.88501280669894, -4.92879267556576, 1.22826199907346,
1.22826199907346, 2.95786185310986, 0.645333302644394, 0.645333302644394,
2.07140449255131, -1.23893895235722, -1.23893895235722, 1.47787167045304,
8.6996620109975, 8.6996620109975, 12.3737211099569, 0.752122732322617,
0.752122732322617, 1.56607549494549, -0.704984743123576, -0.704984743123576,
0.0198201682687236, -0.131726730960604, -0.131726730960604, 2.54861693952509,
-0.63465862593846, -0.63465862593846, 1.39744177545714, 8.09507861455719,
8.09507861455719, 10.7100409195007, 0.697597909614052, 0.697597909614052,
4.22663723088679, -0.908276676629742, -0.908276676629742, 0.988216461685764,
-0.53696857448957, -0.53696857448957, 1.73930496457536, -1.18816405717448,
-1.18816405717448, 1.85709713270274, -0.620510841748233, -0.620510841748233,
1.69402255505977, -0.113228887965414, -0.113228887965414, 1.46541944235744,
-0.793721620714426, -0.793721620714426, 1.46107095464579, -0.852407986696068,
-0.852407986696068, 2.4303445976372), max_value = c(2.48673182921488,
1.55420993203703, 2.48673182921488, 3.62504011030173, 2.51310156228232,
3.62504011030173, 3.42677271496997, 0.383129649599052, 3.42677271496997,
3.74854434284627, -0.425522253262296, 3.74854434284627, 4.14918792025657,
1.9640943196012, 4.14918792025657, 3.24163024948147, 1.82426350140434,
3.24163024948147, 3.72058687493308, 1.36143417733632, 3.72058687493308,
3.10811789516634, 2.82962855877036, 3.10811789516634, 3.88658390957774,
1.63455622431031, 3.88658390957774, -3.48265080475278, -5.2813065556373,
-3.48265080475278, 2.91550924747979, 0.136012216700982, 2.91550924747979,
6.27230603652134, 4.35285188658044, 6.27230603652134, 5.01548205131385,
2.37772331340597, 5.01548205131385, 2.68572236255961, 0.823911641772201,
2.68572236255961, 3.81070437446827, 1.46191739229668, 3.81070437446827,
-3.06234602308199, -4.56698564227954, -3.06234602308199, 5.43297302546367,
3.37332708822159, 5.43297302546367, 5.04541443798249, 2.56699927860427,
5.04541443798249, 4.17487988575546, 1.46297059443906, 4.17487988575546,
14.1025751508761, 12.4183711272285, 14.1025751508761, 3.45571642112819,
2.35498413696494, 3.45571642112819, 1.37141163846293, 0.0771421243145904,
1.37141163846293, 5.05711251664516, 3.09005904310661, 5.05711251664516,
3.89057979440823, 2.08286855290467, 3.89057979440823, 12.6696391427459,
10.9926258281058, 12.6696391427459, 5.84626943044961, 4.42760801361144,
5.84626943044961, 3.48397026129855, 0.843929695173952, 3.48397026129855,
5.1566642614692, 1.9115744466407, 5.1566642614692, 3.19604056443681,
1.48090214867976, 3.19604056443681, 4.11941927820203, 1.52324737728256,
4.11941927820203, 4.21127609192633, 1.69927988323198, 4.21127609192633,
4.47916917588721, 1.77279099521626, 4.47916917588721, 4.49666003774688,
2.84005622902661, 4.49666003774688), mean_value = c(1.24177630116527,
0.613774094518819, 1.86977850781172, 1.72605852593204, 1.02228992277848,
2.4298271290856, 0.927629312914888, -0.35900994194761, 2.21426856777739,
0.260747632756736, -1.27741512285249, 1.79891038836596, 1.64793457105727,
0.342006572760482, 2.95386256935405, 1.57580461640916, 0.720286502261924,
2.4313227305564, 1.61936014971212, 0.783787414798013, 2.45493288462622,
1.88133634325819, 1.0110515853587, 2.75162110115767, 1.45577151776934,
0.468044127106653, 2.44349890843202, -5.53666499085687, -6.40085356456282,
-4.67247641715092, 0.379917337562594, -0.837871853672017, 1.59770652879721,
4.00859832783524, 2.755221845611, 5.26197481005947, 2.8076894766256,
1.69271005793619, 3.922668895315, 1.02488428644579, 0.110231245218908,
1.93953732767268, 1.47368688718138, 0.601753394224174, 2.34562038013858,
-4.95030152449466, -5.52438400696409, -4.37621904202523, 3.4762045542774,
2.27032909064135, 4.68208001791344, 2.48318915060924, 1.67949143661966,
3.28688686459883, 1.3566901287143, -0.0495390252963748, 2.76291928272497,
11.832953173642, 10.5509159694863, 13.1149903777977, 2.02073800609225,
1.45574073221913, 2.58573527996538, 0.228475362320769, -0.320386852160816,
0.777337576802354, 2.58170496397582, 1.60780135441252, 3.55560857353912,
1.72097524693806, 0.909946405551757, 2.53200408832436, 10.5136965135812,
9.4556564914668, 11.5717365356956, 3.96592269432818, 3.02957202885995,
4.90227335979642, 0.918245558162296, -0.0975065583862271, 1.93399767471082,
2.08553574187197, 0.867443465962717, 3.30362801778122, 1.53536210718242,
0.520851529584397, 2.54987268478044, 1.88018083505131, 0.725499972036272,
3.03486169806634, 1.62466786983794, 0.988552032831021, 2.26078370684486,
1.66130673635397, 0.665973440679618, 2.65664003202831, 2.03504771504409,
0.807163462048844, 3.26293196803933), med_value = c(1.31570591336243,
0.673117260882791, 1.96130502023471, 2.05177243873184, 0.984229033787678,
2.20917174116832, 0.331756122986645, -0.417185268488787, 2.53441890665996,
-0.394599860753529, -1.3098320597899, 2.01210614374166, 1.6847508613278,
0.00888181214529415, 3.02114849399441, 1.81890785603417, 0.5955272528093,
2.3243521934078, 1.2699077220455, 0.885849237191548, 2.36598796914253,
2.59756459274135, 1.11847272962714, 2.73024329201096, 1.4890119865391,
0.416355067311528, 2.24503352766485, -5.40582914372845, -6.3862895384795,
-4.68395971180059, 0.155722288210903, -0.817169708329972, 1.79634751834489,
4.21163816439579, 2.81780780592327, 5.41128067654851, 2.39471942988846,
1.74097341883149, 3.96550684665566, 0.822660677464892, 0.0953509838222589,
2.10243335948088, 1.28856716650256, 0.574059687768831, 2.49917982941475,
-4.78914749712957, -5.28160804937772, -4.5880754589768, 3.05143813873319,
2.18274705320577, 4.92239186637914, 2.28203660895734, 1.74941339926081,
3.04768026050623, 1.47042113244605, -0.141957794089912, 2.66651279001467,
12.3888718613563, 10.5022255529843, 13.0375571449821, 1.96046471239662,
1.48674231357901, 2.6137990697891, 0.048481146291657, -0.307450111888204,
0.712666771260362, 2.71242085963533, 1.59058092301575, 3.45522282084598,
1.61880746120317, 1.00956090612484, 2.50356653528887, 10.8714662742399,
9.5932358949005, 11.6128150958074, 4.29575375875245, 3.5189899495096,
4.91076218850134, 0.916073078429858, -0.067208074588031, 1.55989399850389,
1.84508489372872, 1.02839421743576, 3.56548201522565, 1.66899964069125,
0.621088112458978, 2.52409810330148, 1.60863496617116, 0.920735252936729,
3.19292747649624, 1.56671745218764, 1.13214647238373, 1.92457408922848,
1.64420000259481, 0.886365615113318, 2.4164546710419, 2.56712532046386,
0.810000452302254, 2.92633860312995), obs_range = c(2.74146398208271,
1.80894208490486, 1.29066525079744, 4.20666450747963, 3.09472595946023,
1.82218127343188, 4.75623387704889, 1.71259081167798, 3.38702117190829,
5.61637159522202, 1.44230499911345, 4.11222181109103, 5.04387306006745,
2.85877945941208, 2.74693861027209, 3.42375327543351, 2.00638652735637,
1.44462561941554, 3.6576940900376, 1.29854139244084, 2.46964433181769,
3.89388617423556, 3.61539683783958, 0.60495940052619, 4.15437799071098,
1.90235030544356, 2.57211075898566, 3.82469810038283, 2.02604234949831,
1.96719965664107, 4.62227562899341, 1.8427785982146, 2.74007688775897,
5.11695541342963, 3.19750126348873, 2.26512408360535, 4.26744501271426,
1.62968627480638, 2.60376650494291, 3.23033198102614, 1.36852126023874,
1.86431264940202, 4.17763095247057, 1.82884397029898, 2.94925049348036,
3.82266678361694, 2.3180271644194, 1.86644665248377, 4.20471102639021,
2.14506508914814, 2.4751111723538, 4.4000811353381, 1.92166597595988,
2.97400994543118, 5.41381883811268, 2.70190954679628, 2.69700821530242,
5.40291313987857, 3.71870911623099, 1.72885404091919, 2.70359368880557,
1.60286140464233, 1.8896409261827, 2.0763963815865, 0.782126867438166,
1.3515914701942, 5.18883924760576, 3.22178577406721, 2.50849557712007,
4.52523842034669, 2.71752717884313, 2.49313801895109, 4.57456052818866,
2.89754721354865, 1.95959822324513, 5.14867152083556, 3.73001010399739,
1.61963219956282, 4.39224693792829, 1.75220637180369, 2.49575379961279,
5.69363283595877, 2.44854302113027, 3.41735929689384, 4.38420462161129,
2.66906620585424, 1.33894343173407, 4.73993011995027, 2.14375821903079,
2.42539672314227, 4.32450497989175, 1.8125087711974, 2.74585664956889,
5.27289079660163, 2.56651261593069, 3.01809822124141, 5.34906802444294,
3.69246421572268, 2.06631544010968), obs_rough = c(1.02443302484271,
0.571580545153004, 0.42708797443795, 0.954117832103747, 0.458829791333984,
0.479869210652184, 0.831351496820307, 0.426733856168461, 0.404060108000881,
1.2381333607567, 0.464963386061988, 0.754553231413436, 1.0732269517239,
0.405065232210955, 0.652068255920653, 0.765535104883084, 0.360975222849196,
0.398244407829041, 0.972526073817875, 0.413502505182048, 0.468274206165265,
1.0459656860554, 0.579958855998611, 0.443112658329619, 1.52098581249057,
0.615112077793742, 0.899488226272018, 1.13841165265676, 0.556230099629927,
0.563284896018361, 1.09507537455731, 0.532188175078786, 0.55296174273883,
1.06850841086197, 0.465535827086933, 0.586175136469028, 1.05252516877193,
0.467166654840705, 0.574197881284651, 1.21227097175732, 0.572048018397622,
0.610778909294853, 1.24375169380877, 0.538636859278024, 0.645203902455177,
1.23591565133224, 0.704338091419098, 0.517166849562803, 1.12380144216147,
0.496076152944533, 0.624431347147114, 0.913475854824092, 0.269875836548257,
0.632001488837635, 0.795724470071228, 0.270722789809929, 0.49541067923677,
1.02240951960303, 0.495603061080694, 0.517834389086253, 0.94883990333614,
0.473045962655727, 0.453011693478671, 1.29789429361051, 0.723768252236108,
0.554357697115601, 0.952574818069477, 0.671922102047993, 0.259853841983267,
1.07058538012007, 0.554785798221078, 0.476119433688362, 0.929385566682204,
0.330933244141015, 0.596819453256262, 1.06179087262754, 0.547040715618292,
0.512815499720356, 1.1152185272364, 0.548933149671357, 0.48164244408998,
0.849662371081896, 0.360705810132252, 0.449423157889059, 1.243330603723,
0.646151410640352, 0.536270492185523, 1.09700537907372, 0.492602115230773,
0.596347341875593, 0.944330143046192, 0.440796595239547, 0.473516952000716,
1.10076642300436, 0.432870154991159, 0.613173287352346, 1.07971777508736,
0.544333536974537, 0.530789156483833), obs_auc = c(123.038548997389,
30.0688680564511, 91.6768303193684, 170.859801482047, 50.2286048303078,
118.654409267355, 91.9604603320349, -17.2226408033219, 109.196029789976,
24.9545864306287, -62.8674956845195, 88.2013494325979, 162.990400238505,
16.6455437736566, 144.926253571562, 156.338489775649, 35.1317253176906,
119.380743029116, 160.044184226701, 38.731136812282, 120.256463105291,
187.076746280454, 49.4855628256418, 134.738289015578, 143.652788730833,
22.5899997122948, 119.416349997845, -548.177756588616, -313.661991128758,
-229.057065484719, 37.1136199544588, -41.4041686016069, 78.3432507278474,
397.259563113222, 135.029138664752, 257.964073858077, 277.885397030158,
83.0406798880011, 192.470184521947, 101.438947402721, 5.37066780037201,
95.2421544511086, 145.356632912738, 29.3453991502549, 114.892760806238,
-490.072818878892, -270.457867852807, -214.879178321291, 344.303044603136,
111.397587277469, 229.874821931139, 245.472851697096, 82.5868801940001,
160.704434712708, 134.222054073263, -2.57740594139483, 135.185861985034,
1171.88340036846, 516.952907046909, 642.455574038751, 199.98719030707,
71.5954455449163, 126.740321492452, 22.5022492137562, -15.71147511024,
38.1196670685311, 255.677551081243, 79.1152947313106, 173.972222425413,
170.325889168382, 44.8783913951456, 123.724559884695, 1040.99946530262,
463.239040391731, 566.664862299258, 393.360618252336, 148.917250926157,
239.966987172626, 90.2466242431688, -4.9828582495832, 94.4389610847096,
206.23384147382, 42.8372020526136, 161.664946870707, 152.517777634391,
25.8904636560044, 124.95345522305, 186.142983270956, 35.6446966814664,
148.916949135393, 160.412392488505, 48.8127995953674, 110.194440295883,
164.519032173705, 32.9835282490597, 129.948920636025, 201.473587328397,
39.3226691754278, 159.651013228007), obs_var = c(0.600806512905785,
0.255283985416092, 0.153719435449037, 1.08869064895449, 0.94037066575354,
0.248432386655089, 2.24393055976336, 0.164691538535049, 0.990513934960049,
3.20157512214848, 0.129232831023725, 1.51079718567754, 2.40941177838791,
0.722741608761001, 0.664747623623853, 1.00834680977627, 0.361107267362946,
0.182468442931862, 1.13561193946795, 0.108881085100043, 0.76065774090287,
1.47550268807028, 1.41521889400636, 0.0201935577434527, 1.46340900323892,
0.341534587914212, 0.624117483394405, 1.0635361305303, 0.288032256900452,
0.336618515142572, 1.97581084779848, 0.241440094931683, 0.723952201053315,
2.28169782898232, 0.971035668678254, 0.432899524178261, 1.66479544590423,
0.254189793832911, 0.572276302787944, 1.073095795897, 0.212360658960156,
0.248403937187685, 1.25938730944598, 0.278435302503205, 0.714473718335507,
0.734599861194399, 0.559470767213815, 0.252127530549841, 1.88437613550237,
0.392989285850528, 0.446595898532936, 1.26382981541409, 0.316493905403436,
0.918733649265663, 2.5527140846627, 0.335902177234366, 0.785947843636036,
2.2895098556764, 1.02307483351598, 0.248344277259972, 0.589841768491147,
0.238239781717556, 0.302008037307282, 0.39196425198238, 0.040508598582841,
0.13662380749252, 1.53924118708249, 0.772348149093586, 0.401857023337526,
1.20414497569501, 0.441529867885485, 0.64895124308932, 1.55250030981482,
0.622614039175798, 0.229481100254455, 1.48981430809735, 1.06341800033901,
0.157324032913164, 1.45651950847143, 0.306734787567093, 0.530412051440898,
2.48469251631892, 0.753761121261158, 1.23827316144486, 1.39484583387243,
0.545354285220635, 0.172330742280268, 1.79796602915277, 0.354743417781235,
0.55688611986795, 0.815618141764237, 0.289582336905667, 0.532496443207762,
1.71462729721187, 0.558721238316055, 0.883712750993734, 2.53883790224238,
1.61693240685643, 0.435618173686979), obs_coef_var = c(62.4200264997,
82.3195961915544, 20.9688313598045, 60.4500589849074, 94.8583261266684,
20.5129787029824, 161.484276766739, -113.039224093296, 44.9469264982333,
686.217001835744, -28.1419622294943, 68.3271889553305, 94.1923321411898,
248.574787337861, 27.6018448997878, 63.723936453392, 83.4281931550774,
17.5691711160355, 65.8069143263001, 42.0995965980332, 35.5267124761145,
64.565951764858, 117.66261455102, 5.16437522553503, 83.0978224044124,
124.862074414712, 32.331140506584, -18.6263550850169, -8.38460623942883,
-12.4171486968346, 369.984533575101, -58.6444739606533, 53.2546992681212,
37.6822237163683, 35.7652296707268, 12.5038797816462, 45.9548513203239,
29.7849228621425, 19.2850704453578, 101.075154101964, 418.053937962525,
25.6969213479881, 76.1507942117609, 87.6886937046773, 36.0359024530905,
-17.3138546868825, -13.5395690143543, -11.4739006091762, 39.4892125445899,
27.6122337458125, 14.2731073931354, 45.2725019671907, 33.4969204517575,
29.1615131848275, 117.766135045849, -1169.92750682087, 32.0869668765826,
12.7872781707867, 9.58657637570326, 3.7997856831829, 38.0064889968674,
33.529193512084, 21.2532421033098, 274.021005361927, -62.820143471738,
47.5503294160691, 48.0559014218441, 54.660571092465, 17.8287886525843,
63.7624161037967, 73.0237665283233, 31.8157109047402, 11.8511477114883,
8.34483527078968, 4.13975771913494, 30.776684038294, 34.0385241219082,
8.09095919179267, 131.431455302979, -567.999153996238, 37.6574357642493,
75.5820537848948, 100.086542423027, 33.6834904849878, 76.9223045200692,
141.783411262445, 16.2803179651373, 71.3166803461187, 82.0955795192764,
24.5891939280166, 55.5877181544594, 54.4360370185406, 32.2774592137682,
78.8197477563374, 112.238196719039, 35.3852972433757, 78.2965976212478,
157.537677374611, 20.2276288401341), interval = c("all", "(0.901,50.5]",
"(50.5,100]", "all", "(0.901,50.5]", "(50.5,100]", "all", "(0.901,50.5]",
"(50.5,100]", "all", "(0.901,50.5]", "(50.5,100]", "all", "(0.901,50.5]",
"(50.5,100]", "all", "(0.901,50.5]", "(50.5,100]", "all", "(0.901,50.5]",
"(50.5,100]", "all", "(0.901,50.5]", "(50.5,100]", "all", "(0.901,50.5]",
"(50.5,100]", "all", "(0.901,50.5]", "(50.5,100]", "all", "(0.901,50.5]",
"(50.5,100]", "all", "(0.901,50.5]", "(50.5,100]", "all", "(0.901,50.5]",
"(50.5,100]", "all", "(0.901,50.5]", "(50.5,100]", "all", "(0.901,50.5]",
"(50.5,100]", "all", "(0.901,50.5]", "(50.5,100]", "all", "(0.901,50.5]",
"(50.5,100]", "all", "(0.901,50.5]", "(50.5,100]", "all", "(0.901,50.5]",
"(50.5,100]", "all", "(0.901,50.5]", "(50.5,100]", "all", "(0.901,50.5]",
"(50.5,100]", "all", "(0.901,50.5]", "(50.5,100]", "all", "(0.901,50.5]",
"(50.5,100]", "all", "(0.901,50.5]", "(50.5,100]", "all", "(0.901,50.5]",
"(50.5,100]", "all", "(0.901,50.5]", "(50.5,100]", "all", "(0.901,50.5]",
"(50.5,100]", "all", "(0.901,50.5]", "(50.5,100]", "all", "(0.901,50.5]",
"(50.5,100]", "all", "(0.901,50.5]", "(50.5,100]", "all", "(0.901,50.5]",
"(50.5,100]", "all", "(0.901,50.5]", "(50.5,100]", "all", "(0.901,50.5]",
"(50.5,100]")), row.names = c(NA, 99L), class = "data.frame")
实现的代码(注意:这是循环中的一个步骤)
test_summary_grp <- test_profile %>%
tidyr::pivot_longer(c(-obs_idx, -interval),
names_to = "summary_stat") %>%
dplyr::group_by(summary_stat, interval) %>%
dplyr::summarize(q1_stat = quantile(value, probs = 0.25),
q3_stat = quantile(value, probs = 0.75),
iqr_stat = q3_stat - q1_stat,
u_fence = q3_stat + 1.5*iqr_stat,
l_fence = q1_stat - 1.5*iqr_stat)
错误:
Error in `dplyr::summarize()`:
! Problem while computing `q1_stat = quantile(value, probs = 0.25)`.
i The error occurred in group 1: summary_stat = "max_value", interval = <"all",
"all", "all", "all", "all", "all", "all", "all", "all", "all", "all", "all",
"all", "all", "all", "all", "all", "all", "all", "all", "all", "all", "all",
"all", "all", "all", "all", "all", "all", "all">.
Caused by error in `sort.int()`:
! 'x' must be atomic
Backtrace:
x
1. +-global easy_out_fda(test_data = test_data, per_out = out_rate, n_ints = n_int)
2. | \-test_summary_grp %>% ...
3. +-dplyr::summarize(...)
4. +-dplyr:::summarise.grouped_df(...)
5. | \-dplyr:::summarise_cols(.data, dplyr_quosures(...), caller_env = caller_env())
6. | +-base::withCallingHandlers(...)
7. | \-dplyr:::map(quosures, summarise_eval_one, mask = mask)
8. | \-base::lapply(.x, .f, ...)
9. | \-dplyr FUN(X[[i]], ...)
10. | \-mask$eval_all_summarise(quo)
11. +-stats::quantile(value, probs = 0.25)
12. +-stats:::quantile.default(value, probs = 0.25)
13. | +-base::sort(x, partial = unique(c(lo, hi)))
14. | \-base::sort.default(x, partial = unique(c(lo, hi)))
15. | \-base::sort.int(...)
16. | \-base::stop("'x' must be atomic")
17. \-base::.handleSimpleError(...)
18. \-dplyr h(simpleError(msg, call))
19. \-rlang::abort(bullets, call = error_call, parent = skip_internal_condition(e))
Execution halted
我在这里完全丢失了。通过尝试在远程集群上解决此问题,使事情变得更加沮丧。通常,“ X'必须是原子”是通过尝试对列表进行排序的。但是,正如您在上面看到的那样,我没有通过列表。我什至将DPLYR管道分开以在汇总步骤之前就获得数据框架的反馈:
test_summary_grp <- test_profile %>%
tidyr::pivot_longer(c(-obs_idx, -interval),
names_to = "summary_stat") %>%
dplyr::group_by(summary_stat, interval)
cat("Class of test summary before summarize:",
class(test_summary_grp), "; iter = ", iter, "\n")
test_summary <- test_summary_grp %>%
dplyr::summarize(q1_stat = quantile(value, probs = 0.25),
q3_stat = quantile(value, probs = 0.75),
iqr_stat = q3_stat - q1_stat,
u_fence = q3_stat + 1.5*iqr_stat,
l_fence = q1_stat - 1.5*iqr_stat)
但是,这没有发现任何东西,因为猫消息回馈:
Class of test summary before summarize: grouped_df tbl_df tbl data.frame ; iter = 1
时,问题不会出现,
R version 4.1.2 (2021-11-01) -- "Bird Hippie"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin17.0 (64-bit)
为了使事情进一步复杂化,当我在自己的机器上实施规格和dplyr
版本
> packageVersion("dplyr")
[1] ‘1.0.8’
似乎没有押韵或理由是什么trip trip此错误。在一个模拟中,它发生在第一次迭代中。其他时候,它发生了一部分。然后在其他时候根本没有错误,并且模拟运行到完成。我认为自己很擅长诊断这些问题,但是仅在Ubuntu Super Computer上跳出错误而无法在我自己的机器上复制的添加复杂性,这使得很难找到此错误的源头。任何想法或技巧都将不胜感激!
System specs (running on an HPC remote cluster, so I cannot update R):
R version 3.6.0 (2019-04-26) -- "Planting of a Tree"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-conda_cos6-linux-gnu (64-bit)
Package specs:
> packageVersion("dplyr")
[1] ‘1.0.8’
Header of data frame test_profile
:
Obs_idx | Int | Min | Mean | Max |
---|---|---|---|---|
Obs001 | "all" | -0.255 | 1.242 | 2.487 |
Obs001 | "(0.901, 50.5]" | -0.255 | 0.614 | 1.554 |
Obs001 | "(50.5, 100]" | 1.196 | 1.870 | 2.487 |
Obs002 | "all" |
And here's the first 99 observations for easier reproduction:
structure(list(obs_idx = c("Obs001", "Obs001", "Obs001", "Obs002",
"Obs002", "Obs002", "Obs003", "Obs003", "Obs003", "Obs004", "Obs004",
"Obs004", "Obs005", "Obs005", "Obs005", "Obs006", "Obs006", "Obs006",
"Obs007", "Obs007", "Obs007", "Obs008", "Obs008", "Obs008", "Obs009",
"Obs009", "Obs009", "Obs010", "Obs010", "Obs010", "Obs011", "Obs011",
"Obs011", "Obs012", "Obs012", "Obs012", "Obs013", "Obs013", "Obs013",
"Obs014", "Obs014", "Obs014", "Obs015", "Obs015", "Obs015", "Obs016",
"Obs016", "Obs016", "Obs017", "Obs017", "Obs017", "Obs018", "Obs018",
"Obs018", "Obs019", "Obs019", "Obs019", "Obs020", "Obs020", "Obs020",
"Obs021", "Obs021", "Obs021", "Obs022", "Obs022", "Obs022", "Obs023",
"Obs023", "Obs023", "Obs024", "Obs024", "Obs024", "Obs025", "Obs025",
"Obs025", "Obs026", "Obs026", "Obs026", "Obs027", "Obs027", "Obs027",
"Obs028", "Obs028", "Obs028", "Obs029", "Obs029", "Obs029", "Obs030",
"Obs030", "Obs030", "Obs031", "Obs031", "Obs031", "Obs032", "Obs032",
"Obs032", "Obs033", "Obs033", "Obs033"), min_value = c(-0.254732152867833,
-0.254732152867833, 1.19606657841744, -0.581624397177908, -0.581624397177908,
1.80285883686985, -1.32946116207892, -1.32946116207892, 0.0397515430616804,
-1.86782725237575, -1.86782725237575, -0.363677468244763, -0.89468513981088,
-0.89468513981088, 1.40224930998449, -0.182123025952034, -0.182123025952034,
1.79700463006594, 0.0628927848954747, 0.0628927848954747, 1.25094254311538,
-0.785768279069217, -0.785768279069217, 2.50315849464015, -0.267794081133244,
-0.267794081133244, 1.31447315059208, -7.30734890513561, -7.30734890513561,
-5.44985046139385, -1.70676638151362, -1.70676638151362, 0.175432359720823,
1.15535062309171, 1.15535062309171, 4.00718195291599, 0.74803703859959,
0.74803703859959, 2.41171554637094, -0.544609618466537, -0.544609618466537,
0.821409713157584, -0.366926578002299, -0.366926578002299, 0.861453880987911,
-6.88501280669894, -6.88501280669894, -4.92879267556576, 1.22826199907346,
1.22826199907346, 2.95786185310986, 0.645333302644394, 0.645333302644394,
2.07140449255131, -1.23893895235722, -1.23893895235722, 1.47787167045304,
8.6996620109975, 8.6996620109975, 12.3737211099569, 0.752122732322617,
0.752122732322617, 1.56607549494549, -0.704984743123576, -0.704984743123576,
0.0198201682687236, -0.131726730960604, -0.131726730960604, 2.54861693952509,
-0.63465862593846, -0.63465862593846, 1.39744177545714, 8.09507861455719,
8.09507861455719, 10.7100409195007, 0.697597909614052, 0.697597909614052,
4.22663723088679, -0.908276676629742, -0.908276676629742, 0.988216461685764,
-0.53696857448957, -0.53696857448957, 1.73930496457536, -1.18816405717448,
-1.18816405717448, 1.85709713270274, -0.620510841748233, -0.620510841748233,
1.69402255505977, -0.113228887965414, -0.113228887965414, 1.46541944235744,
-0.793721620714426, -0.793721620714426, 1.46107095464579, -0.852407986696068,
-0.852407986696068, 2.4303445976372), max_value = c(2.48673182921488,
1.55420993203703, 2.48673182921488, 3.62504011030173, 2.51310156228232,
3.62504011030173, 3.42677271496997, 0.383129649599052, 3.42677271496997,
3.74854434284627, -0.425522253262296, 3.74854434284627, 4.14918792025657,
1.9640943196012, 4.14918792025657, 3.24163024948147, 1.82426350140434,
3.24163024948147, 3.72058687493308, 1.36143417733632, 3.72058687493308,
3.10811789516634, 2.82962855877036, 3.10811789516634, 3.88658390957774,
1.63455622431031, 3.88658390957774, -3.48265080475278, -5.2813065556373,
-3.48265080475278, 2.91550924747979, 0.136012216700982, 2.91550924747979,
6.27230603652134, 4.35285188658044, 6.27230603652134, 5.01548205131385,
2.37772331340597, 5.01548205131385, 2.68572236255961, 0.823911641772201,
2.68572236255961, 3.81070437446827, 1.46191739229668, 3.81070437446827,
-3.06234602308199, -4.56698564227954, -3.06234602308199, 5.43297302546367,
3.37332708822159, 5.43297302546367, 5.04541443798249, 2.56699927860427,
5.04541443798249, 4.17487988575546, 1.46297059443906, 4.17487988575546,
14.1025751508761, 12.4183711272285, 14.1025751508761, 3.45571642112819,
2.35498413696494, 3.45571642112819, 1.37141163846293, 0.0771421243145904,
1.37141163846293, 5.05711251664516, 3.09005904310661, 5.05711251664516,
3.89057979440823, 2.08286855290467, 3.89057979440823, 12.6696391427459,
10.9926258281058, 12.6696391427459, 5.84626943044961, 4.42760801361144,
5.84626943044961, 3.48397026129855, 0.843929695173952, 3.48397026129855,
5.1566642614692, 1.9115744466407, 5.1566642614692, 3.19604056443681,
1.48090214867976, 3.19604056443681, 4.11941927820203, 1.52324737728256,
4.11941927820203, 4.21127609192633, 1.69927988323198, 4.21127609192633,
4.47916917588721, 1.77279099521626, 4.47916917588721, 4.49666003774688,
2.84005622902661, 4.49666003774688), mean_value = c(1.24177630116527,
0.613774094518819, 1.86977850781172, 1.72605852593204, 1.02228992277848,
2.4298271290856, 0.927629312914888, -0.35900994194761, 2.21426856777739,
0.260747632756736, -1.27741512285249, 1.79891038836596, 1.64793457105727,
0.342006572760482, 2.95386256935405, 1.57580461640916, 0.720286502261924,
2.4313227305564, 1.61936014971212, 0.783787414798013, 2.45493288462622,
1.88133634325819, 1.0110515853587, 2.75162110115767, 1.45577151776934,
0.468044127106653, 2.44349890843202, -5.53666499085687, -6.40085356456282,
-4.67247641715092, 0.379917337562594, -0.837871853672017, 1.59770652879721,
4.00859832783524, 2.755221845611, 5.26197481005947, 2.8076894766256,
1.69271005793619, 3.922668895315, 1.02488428644579, 0.110231245218908,
1.93953732767268, 1.47368688718138, 0.601753394224174, 2.34562038013858,
-4.95030152449466, -5.52438400696409, -4.37621904202523, 3.4762045542774,
2.27032909064135, 4.68208001791344, 2.48318915060924, 1.67949143661966,
3.28688686459883, 1.3566901287143, -0.0495390252963748, 2.76291928272497,
11.832953173642, 10.5509159694863, 13.1149903777977, 2.02073800609225,
1.45574073221913, 2.58573527996538, 0.228475362320769, -0.320386852160816,
0.777337576802354, 2.58170496397582, 1.60780135441252, 3.55560857353912,
1.72097524693806, 0.909946405551757, 2.53200408832436, 10.5136965135812,
9.4556564914668, 11.5717365356956, 3.96592269432818, 3.02957202885995,
4.90227335979642, 0.918245558162296, -0.0975065583862271, 1.93399767471082,
2.08553574187197, 0.867443465962717, 3.30362801778122, 1.53536210718242,
0.520851529584397, 2.54987268478044, 1.88018083505131, 0.725499972036272,
3.03486169806634, 1.62466786983794, 0.988552032831021, 2.26078370684486,
1.66130673635397, 0.665973440679618, 2.65664003202831, 2.03504771504409,
0.807163462048844, 3.26293196803933), med_value = c(1.31570591336243,
0.673117260882791, 1.96130502023471, 2.05177243873184, 0.984229033787678,
2.20917174116832, 0.331756122986645, -0.417185268488787, 2.53441890665996,
-0.394599860753529, -1.3098320597899, 2.01210614374166, 1.6847508613278,
0.00888181214529415, 3.02114849399441, 1.81890785603417, 0.5955272528093,
2.3243521934078, 1.2699077220455, 0.885849237191548, 2.36598796914253,
2.59756459274135, 1.11847272962714, 2.73024329201096, 1.4890119865391,
0.416355067311528, 2.24503352766485, -5.40582914372845, -6.3862895384795,
-4.68395971180059, 0.155722288210903, -0.817169708329972, 1.79634751834489,
4.21163816439579, 2.81780780592327, 5.41128067654851, 2.39471942988846,
1.74097341883149, 3.96550684665566, 0.822660677464892, 0.0953509838222589,
2.10243335948088, 1.28856716650256, 0.574059687768831, 2.49917982941475,
-4.78914749712957, -5.28160804937772, -4.5880754589768, 3.05143813873319,
2.18274705320577, 4.92239186637914, 2.28203660895734, 1.74941339926081,
3.04768026050623, 1.47042113244605, -0.141957794089912, 2.66651279001467,
12.3888718613563, 10.5022255529843, 13.0375571449821, 1.96046471239662,
1.48674231357901, 2.6137990697891, 0.048481146291657, -0.307450111888204,
0.712666771260362, 2.71242085963533, 1.59058092301575, 3.45522282084598,
1.61880746120317, 1.00956090612484, 2.50356653528887, 10.8714662742399,
9.5932358949005, 11.6128150958074, 4.29575375875245, 3.5189899495096,
4.91076218850134, 0.916073078429858, -0.067208074588031, 1.55989399850389,
1.84508489372872, 1.02839421743576, 3.56548201522565, 1.66899964069125,
0.621088112458978, 2.52409810330148, 1.60863496617116, 0.920735252936729,
3.19292747649624, 1.56671745218764, 1.13214647238373, 1.92457408922848,
1.64420000259481, 0.886365615113318, 2.4164546710419, 2.56712532046386,
0.810000452302254, 2.92633860312995), obs_range = c(2.74146398208271,
1.80894208490486, 1.29066525079744, 4.20666450747963, 3.09472595946023,
1.82218127343188, 4.75623387704889, 1.71259081167798, 3.38702117190829,
5.61637159522202, 1.44230499911345, 4.11222181109103, 5.04387306006745,
2.85877945941208, 2.74693861027209, 3.42375327543351, 2.00638652735637,
1.44462561941554, 3.6576940900376, 1.29854139244084, 2.46964433181769,
3.89388617423556, 3.61539683783958, 0.60495940052619, 4.15437799071098,
1.90235030544356, 2.57211075898566, 3.82469810038283, 2.02604234949831,
1.96719965664107, 4.62227562899341, 1.8427785982146, 2.74007688775897,
5.11695541342963, 3.19750126348873, 2.26512408360535, 4.26744501271426,
1.62968627480638, 2.60376650494291, 3.23033198102614, 1.36852126023874,
1.86431264940202, 4.17763095247057, 1.82884397029898, 2.94925049348036,
3.82266678361694, 2.3180271644194, 1.86644665248377, 4.20471102639021,
2.14506508914814, 2.4751111723538, 4.4000811353381, 1.92166597595988,
2.97400994543118, 5.41381883811268, 2.70190954679628, 2.69700821530242,
5.40291313987857, 3.71870911623099, 1.72885404091919, 2.70359368880557,
1.60286140464233, 1.8896409261827, 2.0763963815865, 0.782126867438166,
1.3515914701942, 5.18883924760576, 3.22178577406721, 2.50849557712007,
4.52523842034669, 2.71752717884313, 2.49313801895109, 4.57456052818866,
2.89754721354865, 1.95959822324513, 5.14867152083556, 3.73001010399739,
1.61963219956282, 4.39224693792829, 1.75220637180369, 2.49575379961279,
5.69363283595877, 2.44854302113027, 3.41735929689384, 4.38420462161129,
2.66906620585424, 1.33894343173407, 4.73993011995027, 2.14375821903079,
2.42539672314227, 4.32450497989175, 1.8125087711974, 2.74585664956889,
5.27289079660163, 2.56651261593069, 3.01809822124141, 5.34906802444294,
3.69246421572268, 2.06631544010968), obs_rough = c(1.02443302484271,
0.571580545153004, 0.42708797443795, 0.954117832103747, 0.458829791333984,
0.479869210652184, 0.831351496820307, 0.426733856168461, 0.404060108000881,
1.2381333607567, 0.464963386061988, 0.754553231413436, 1.0732269517239,
0.405065232210955, 0.652068255920653, 0.765535104883084, 0.360975222849196,
0.398244407829041, 0.972526073817875, 0.413502505182048, 0.468274206165265,
1.0459656860554, 0.579958855998611, 0.443112658329619, 1.52098581249057,
0.615112077793742, 0.899488226272018, 1.13841165265676, 0.556230099629927,
0.563284896018361, 1.09507537455731, 0.532188175078786, 0.55296174273883,
1.06850841086197, 0.465535827086933, 0.586175136469028, 1.05252516877193,
0.467166654840705, 0.574197881284651, 1.21227097175732, 0.572048018397622,
0.610778909294853, 1.24375169380877, 0.538636859278024, 0.645203902455177,
1.23591565133224, 0.704338091419098, 0.517166849562803, 1.12380144216147,
0.496076152944533, 0.624431347147114, 0.913475854824092, 0.269875836548257,
0.632001488837635, 0.795724470071228, 0.270722789809929, 0.49541067923677,
1.02240951960303, 0.495603061080694, 0.517834389086253, 0.94883990333614,
0.473045962655727, 0.453011693478671, 1.29789429361051, 0.723768252236108,
0.554357697115601, 0.952574818069477, 0.671922102047993, 0.259853841983267,
1.07058538012007, 0.554785798221078, 0.476119433688362, 0.929385566682204,
0.330933244141015, 0.596819453256262, 1.06179087262754, 0.547040715618292,
0.512815499720356, 1.1152185272364, 0.548933149671357, 0.48164244408998,
0.849662371081896, 0.360705810132252, 0.449423157889059, 1.243330603723,
0.646151410640352, 0.536270492185523, 1.09700537907372, 0.492602115230773,
0.596347341875593, 0.944330143046192, 0.440796595239547, 0.473516952000716,
1.10076642300436, 0.432870154991159, 0.613173287352346, 1.07971777508736,
0.544333536974537, 0.530789156483833), obs_auc = c(123.038548997389,
30.0688680564511, 91.6768303193684, 170.859801482047, 50.2286048303078,
118.654409267355, 91.9604603320349, -17.2226408033219, 109.196029789976,
24.9545864306287, -62.8674956845195, 88.2013494325979, 162.990400238505,
16.6455437736566, 144.926253571562, 156.338489775649, 35.1317253176906,
119.380743029116, 160.044184226701, 38.731136812282, 120.256463105291,
187.076746280454, 49.4855628256418, 134.738289015578, 143.652788730833,
22.5899997122948, 119.416349997845, -548.177756588616, -313.661991128758,
-229.057065484719, 37.1136199544588, -41.4041686016069, 78.3432507278474,
397.259563113222, 135.029138664752, 257.964073858077, 277.885397030158,
83.0406798880011, 192.470184521947, 101.438947402721, 5.37066780037201,
95.2421544511086, 145.356632912738, 29.3453991502549, 114.892760806238,
-490.072818878892, -270.457867852807, -214.879178321291, 344.303044603136,
111.397587277469, 229.874821931139, 245.472851697096, 82.5868801940001,
160.704434712708, 134.222054073263, -2.57740594139483, 135.185861985034,
1171.88340036846, 516.952907046909, 642.455574038751, 199.98719030707,
71.5954455449163, 126.740321492452, 22.5022492137562, -15.71147511024,
38.1196670685311, 255.677551081243, 79.1152947313106, 173.972222425413,
170.325889168382, 44.8783913951456, 123.724559884695, 1040.99946530262,
463.239040391731, 566.664862299258, 393.360618252336, 148.917250926157,
239.966987172626, 90.2466242431688, -4.9828582495832, 94.4389610847096,
206.23384147382, 42.8372020526136, 161.664946870707, 152.517777634391,
25.8904636560044, 124.95345522305, 186.142983270956, 35.6446966814664,
148.916949135393, 160.412392488505, 48.8127995953674, 110.194440295883,
164.519032173705, 32.9835282490597, 129.948920636025, 201.473587328397,
39.3226691754278, 159.651013228007), obs_var = c(0.600806512905785,
0.255283985416092, 0.153719435449037, 1.08869064895449, 0.94037066575354,
0.248432386655089, 2.24393055976336, 0.164691538535049, 0.990513934960049,
3.20157512214848, 0.129232831023725, 1.51079718567754, 2.40941177838791,
0.722741608761001, 0.664747623623853, 1.00834680977627, 0.361107267362946,
0.182468442931862, 1.13561193946795, 0.108881085100043, 0.76065774090287,
1.47550268807028, 1.41521889400636, 0.0201935577434527, 1.46340900323892,
0.341534587914212, 0.624117483394405, 1.0635361305303, 0.288032256900452,
0.336618515142572, 1.97581084779848, 0.241440094931683, 0.723952201053315,
2.28169782898232, 0.971035668678254, 0.432899524178261, 1.66479544590423,
0.254189793832911, 0.572276302787944, 1.073095795897, 0.212360658960156,
0.248403937187685, 1.25938730944598, 0.278435302503205, 0.714473718335507,
0.734599861194399, 0.559470767213815, 0.252127530549841, 1.88437613550237,
0.392989285850528, 0.446595898532936, 1.26382981541409, 0.316493905403436,
0.918733649265663, 2.5527140846627, 0.335902177234366, 0.785947843636036,
2.2895098556764, 1.02307483351598, 0.248344277259972, 0.589841768491147,
0.238239781717556, 0.302008037307282, 0.39196425198238, 0.040508598582841,
0.13662380749252, 1.53924118708249, 0.772348149093586, 0.401857023337526,
1.20414497569501, 0.441529867885485, 0.64895124308932, 1.55250030981482,
0.622614039175798, 0.229481100254455, 1.48981430809735, 1.06341800033901,
0.157324032913164, 1.45651950847143, 0.306734787567093, 0.530412051440898,
2.48469251631892, 0.753761121261158, 1.23827316144486, 1.39484583387243,
0.545354285220635, 0.172330742280268, 1.79796602915277, 0.354743417781235,
0.55688611986795, 0.815618141764237, 0.289582336905667, 0.532496443207762,
1.71462729721187, 0.558721238316055, 0.883712750993734, 2.53883790224238,
1.61693240685643, 0.435618173686979), obs_coef_var = c(62.4200264997,
82.3195961915544, 20.9688313598045, 60.4500589849074, 94.8583261266684,
20.5129787029824, 161.484276766739, -113.039224093296, 44.9469264982333,
686.217001835744, -28.1419622294943, 68.3271889553305, 94.1923321411898,
248.574787337861, 27.6018448997878, 63.723936453392, 83.4281931550774,
17.5691711160355, 65.8069143263001, 42.0995965980332, 35.5267124761145,
64.565951764858, 117.66261455102, 5.16437522553503, 83.0978224044124,
124.862074414712, 32.331140506584, -18.6263550850169, -8.38460623942883,
-12.4171486968346, 369.984533575101, -58.6444739606533, 53.2546992681212,
37.6822237163683, 35.7652296707268, 12.5038797816462, 45.9548513203239,
29.7849228621425, 19.2850704453578, 101.075154101964, 418.053937962525,
25.6969213479881, 76.1507942117609, 87.6886937046773, 36.0359024530905,
-17.3138546868825, -13.5395690143543, -11.4739006091762, 39.4892125445899,
27.6122337458125, 14.2731073931354, 45.2725019671907, 33.4969204517575,
29.1615131848275, 117.766135045849, -1169.92750682087, 32.0869668765826,
12.7872781707867, 9.58657637570326, 3.7997856831829, 38.0064889968674,
33.529193512084, 21.2532421033098, 274.021005361927, -62.820143471738,
47.5503294160691, 48.0559014218441, 54.660571092465, 17.8287886525843,
63.7624161037967, 73.0237665283233, 31.8157109047402, 11.8511477114883,
8.34483527078968, 4.13975771913494, 30.776684038294, 34.0385241219082,
8.09095919179267, 131.431455302979, -567.999153996238, 37.6574357642493,
75.5820537848948, 100.086542423027, 33.6834904849878, 76.9223045200692,
141.783411262445, 16.2803179651373, 71.3166803461187, 82.0955795192764,
24.5891939280166, 55.5877181544594, 54.4360370185406, 32.2774592137682,
78.8197477563374, 112.238196719039, 35.3852972433757, 78.2965976212478,
157.537677374611, 20.2276288401341), interval = c("all", "(0.901,50.5]",
"(50.5,100]", "all", "(0.901,50.5]", "(50.5,100]", "all", "(0.901,50.5]",
"(50.5,100]", "all", "(0.901,50.5]", "(50.5,100]", "all", "(0.901,50.5]",
"(50.5,100]", "all", "(0.901,50.5]", "(50.5,100]", "all", "(0.901,50.5]",
"(50.5,100]", "all", "(0.901,50.5]", "(50.5,100]", "all", "(0.901,50.5]",
"(50.5,100]", "all", "(0.901,50.5]", "(50.5,100]", "all", "(0.901,50.5]",
"(50.5,100]", "all", "(0.901,50.5]", "(50.5,100]", "all", "(0.901,50.5]",
"(50.5,100]", "all", "(0.901,50.5]", "(50.5,100]", "all", "(0.901,50.5]",
"(50.5,100]", "all", "(0.901,50.5]", "(50.5,100]", "all", "(0.901,50.5]",
"(50.5,100]", "all", "(0.901,50.5]", "(50.5,100]", "all", "(0.901,50.5]",
"(50.5,100]", "all", "(0.901,50.5]", "(50.5,100]", "all", "(0.901,50.5]",
"(50.5,100]", "all", "(0.901,50.5]", "(50.5,100]", "all", "(0.901,50.5]",
"(50.5,100]", "all", "(0.901,50.5]", "(50.5,100]", "all", "(0.901,50.5]",
"(50.5,100]", "all", "(0.901,50.5]", "(50.5,100]", "all", "(0.901,50.5]",
"(50.5,100]", "all", "(0.901,50.5]", "(50.5,100]", "all", "(0.901,50.5]",
"(50.5,100]", "all", "(0.901,50.5]", "(50.5,100]", "all", "(0.901,50.5]",
"(50.5,100]", "all", "(0.901,50.5]", "(50.5,100]", "all", "(0.901,50.5]",
"(50.5,100]")), row.names = c(NA, 99L), class = "data.frame")
Code implemented (Note: this is one step within a loop)
test_summary_grp <- test_profile %>%
tidyr::pivot_longer(c(-obs_idx, -interval),
names_to = "summary_stat") %>%
dplyr::group_by(summary_stat, interval) %>%
dplyr::summarize(q1_stat = quantile(value, probs = 0.25),
q3_stat = quantile(value, probs = 0.75),
iqr_stat = q3_stat - q1_stat,
u_fence = q3_stat + 1.5*iqr_stat,
l_fence = q1_stat - 1.5*iqr_stat)
Error returned:
Error in `dplyr::summarize()`:
! Problem while computing `q1_stat = quantile(value, probs = 0.25)`.
i The error occurred in group 1: summary_stat = "max_value", interval = <"all",
"all", "all", "all", "all", "all", "all", "all", "all", "all", "all", "all",
"all", "all", "all", "all", "all", "all", "all", "all", "all", "all", "all",
"all", "all", "all", "all", "all", "all", "all">.
Caused by error in `sort.int()`:
! 'x' must be atomic
Backtrace:
x
1. +-global easy_out_fda(test_data = test_data, per_out = out_rate, n_ints = n_int)
2. | \-test_summary_grp %>% ...
3. +-dplyr::summarize(...)
4. +-dplyr:::summarise.grouped_df(...)
5. | \-dplyr:::summarise_cols(.data, dplyr_quosures(...), caller_env = caller_env())
6. | +-base::withCallingHandlers(...)
7. | \-dplyr:::map(quosures, summarise_eval_one, mask = mask)
8. | \-base::lapply(.x, .f, ...)
9. | \-dplyr FUN(X[[i]], ...)
10. | \-mask$eval_all_summarise(quo)
11. +-stats::quantile(value, probs = 0.25)
12. +-stats:::quantile.default(value, probs = 0.25)
13. | +-base::sort(x, partial = unique(c(lo, hi)))
14. | \-base::sort.default(x, partial = unique(c(lo, hi)))
15. | \-base::sort.int(...)
16. | \-base::stop("'x' must be atomic")
17. \-base::.handleSimpleError(...)
18. \-dplyr h(simpleError(msg, call))
19. \-rlang::abort(bullets, call = error_call, parent = skip_internal_condition(e))
Execution halted
I am completely at a loss here. Things are made more frustrating by trying to resolve this on a remote cluster. More often than not, "'x' must be atomic" is tripped by trying to sort a list. Yet, as you can see above, I am not passing a list in. I even split the dplyr pipeline to get feedback on the state of the data frame right before the summarize step like so:
test_summary_grp <- test_profile %>%
tidyr::pivot_longer(c(-obs_idx, -interval),
names_to = "summary_stat") %>%
dplyr::group_by(summary_stat, interval)
cat("Class of test summary before summarize:",
class(test_summary_grp), "; iter = ", iter, "\n")
test_summary <- test_summary_grp %>%
dplyr::summarize(q1_stat = quantile(value, probs = 0.25),
q3_stat = quantile(value, probs = 0.75),
iqr_stat = q3_stat - q1_stat,
u_fence = q3_stat + 1.5*iqr_stat,
l_fence = q1_stat - 1.5*iqr_stat)
But that did not uncover anything, as the cat message gives back:
Class of test summary before summarize: grouped_df tbl_df tbl data.frame ; iter = 1
To complicate matters further, the issue does not arise when I implement on my own machine with specs
R version 4.1.2 (2021-11-01) -- "Bird Hippie"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin17.0 (64-bit)
and dplyr
version
> packageVersion("dplyr")
[1] ‘1.0.8’
There seems to be no rhyme or reason as to what trips this error. On one simulation, it happens on the very first iteration. Other times, it happens part way through. Then other times, there is no error at all, and the simulation runs to completion. I consider myself rather good at diagnosing these issues, but the added complexity of only tripping an error on the Ubuntu super computer, without being able to reproduce on my own machine, makes it extremely difficult to find the source of this error. Any ideas or tips would be greatly appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在评论中与@akrun交谈后,我发现了问题的根源:
r 3.6.0
中的怪异行为尝试进行test_profile&lt; - rbind(df1,df2)&gt ;%as.data.frame()
。如果我用test_profile&lt; - bind_rows(df1,df2)
替换它,则不会出现问题。在
r 4.1.2
中,似乎更容易处理tbl_df
当使用base> base
功能之类的功能,例如rbind
;然而,在r 3.6.0
中,使用rbind
时,我们最终获得了具有列表列的数据框架。我将其留在这里,因为正如@akrun指出的那样,我们应该始终诊断出使用匹配的软件包和R版本!
After conversing with @akrun in the comments, I found the root of the issue: weird behavior in
R 3.6.0
when trying to dotest_profile <- rbind(df1, df2) %>% as.data.frame()
. If I replace that withtest_profile <- bind_rows(df1, df2)
, the issue does not appear.In
R 4.1.2
, it seems it's easier able to handletbl_df
types when usingbase
functions likerbind
; yet inR 3.6.0
, when usingrbind
, we end up with a data frame that has columns of lists.I'll leave this here, because as @akrun pointed out, we should always diagnose with matching package and R versions!