How to plot cohorts in R - r

I am trying to plot a cohort trace of 15 health states in R but I dont really know how to do it in the right way.
My data looks like this:
dput(m_M_ad)
structure(c(0.27, 0.256305347853185, 0.242951797354611, 0.230338299921634,
0.217887258961913, 0.206025667287424, 0.194528979719196, 0.183521237213434,
0.172613550573761, 0.162125923204547, 0.151911608290387, 0.141973282939457,
0.132384528668431, 0.123063114917053, 0.11409239073185, 0.105133571796206,
0.0964203968902034, 0.0880524400334065, 0.0796819390545833, 0.0715595854274743,
0.0637832780760189, 0.0562452782961504, 0.048895299564326, 0.0420162775188823,
0.0355429328075438, 0.0296701003100819, 0.0241478188660469, 0.0193789874288362,
0.015053609850195, 0.0114393543650247, 0.00850240847915511, 0.00611969003581926,
0.00425688548697882, 0.00286069846863142, 0.00184377068125287,
0.00115832820003068, 0.73, 0.694258518269723, 0.659309431031376,
0.626239989358266, 0.59349048593319, 0.56222592658017, 0.531841994942455,
0.502682882175171, 0.473690367815364, 0.445743656866086, 0.418445265742517,
0.391806302085698, 0.366033618174396, 0.340904804524758, 0.316654434816042,
0.292347251027103, 0.268632863795214, 0.245792040526907, 0.222858984287112,
0.200534154983283, 0.179095252475684, 0.158244724923299, 0.137844248925194,
0.118693709948007, 0.10061576242418, 0.0841678950816436, 0.0686504682655951,
0.0552138569891875, 0.0429873358711903, 0.0327420661761112, 0.0243934768369293,
0.0176003713912805, 0.0122738786801316, 0.00826985442880786,
0.00534462216383268, 0.00336710531708768, 0, 0.00635, 0.0123249090324111,
0.0179378598991147, 0.0231694678489822, 0.0280447303732529, 0.0325497905192035,
0.0367035848654766, 0.040439424918347, 0.0438053809687469, 0.0467677583196886,
0.0493183254852193, 0.0514740374755558, 0.0532036790499603, 0.0545344606685087,
0.0553072778008801, 0.0556004711086501, 0.0554588516511904, 0.054666580475368,
0.0533417235912645, 0.0515432246481583, 0.0491880384974129, 0.0462162536830676,
0.0428676003665985, 0.0391088869990321, 0.0351768664658957, 0.0308506501675402,
0.0266613975675514, 0.0223199580028192, 0.018280536217857, 0.014646595679713,
0.0113750146607816, 0.00854788116817462, 0.00621359424947056,
0.0043402964971858, 0.00295740756408225, 0, 0.003175, 0.00616245451620557,
0.00896892994955736, 0.0115847339244911, 0.0140223651866265,
0.0162748952596017, 0.0183517924327383, 0.0202197124591735, 0.0219026904843735,
0.0233838791598443, 0.0246591627426097, 0.0257370187377779, 0.0266018395249801,
0.0272672303342543, 0.02765363890044, 0.027800235554325, 0.0277294258255952,
0.027333290237684, 0.0266708617956323, 0.0257716123240792, 0.0245940192487064,
0.0231081268415338, 0.0214338001832992, 0.019554443499516, 0.0175884332329479,
0.0154253250837701, 0.0133306987837757, 0.0111599790014096, 0.00914026810892852,
0.00732329783985649, 0.00568750733039081, 0.00427394058408731,
0.00310679712473528, 0.0021701482485929, 0.00147870378204113,
0, 0.00127, 0.00246498180648223, 0.00358757197982294, 0.00463389356979643,
0.00560894607465059, 0.00650995810384069, 0.00734071697309532,
0.00808788498366939, 0.00876107619374939, 0.00935355166393771,
0.00986366509704387, 0.0102948074951112, 0.0106407358099921,
0.0109068921337017, 0.011061455560176, 0.01112009422173, 0.0110917703302381,
0.0109333160950736, 0.0106683447182529, 0.0103086449296317, 0.00983760769948257,
0.00924325073661352, 0.0085735200733197, 0.00782177739980641,
0.00703537329317915, 0.00617013003350804, 0.00533227951351027,
0.00446399160056385, 0.00365610724357141, 0.0029293191359426,
0.00227500293215632, 0.00170957623363492, 0.00124271884989411,
0.00086805929943716, 0.00059148151281645, 0, 0.00254, 0.00495373842795219,
0.00724416447943338, 0.00941799765783645, 0.0114765276655505,
0.0134250821878605, 0.0152668820966222, 0.0170063328098263, 0.0186441677477521,
0.0201841587543024, 0.021628695718949, 0.0229802014548782, 0.0242418068059007,
0.0254158688746185, 0.026505547307178, 0.027510776096417, 0.0284337234115682,
0.0292775172527557, 0.0300419629775482, 0.0307292696292247, 0.0313425932464801,
0.0318840638095113, 0.032355333505619, 0.0327607860355906, 0.0331041892916691,
0.0333912054830727, 0.0336250976950681, 0.0338130413587618, 0.033959230469905,
0.0340704720197173, 0.0341532686073078, 0.0342129481102336, 0.0342545234095418,
0.0342825059122739, 0.0343005702393266, 0, 0.000692346, 0.00134412344655775,
0.00195672806876768, 0.00252801068096107, 0.00306066343458451,
0.00355314150949529, 0.00400747924737695, 0.00441636473408992,
0.00478501307171198, 0.00510971345719726, 0.00538953475998585,
0.00562629837313592, 0.0058165629823512, 0.0059632727736761,
0.00604900199267857, 0.00608228125124658, 0.00606798125054011,
0.00598245874170456, 0.00583859400377125, 0.00564280712439055,
0.00538597952584612, 0.00506151969398995, 0.00469564824350054,
0.00428471061386547, 0.00385462466300522, 0.00338117983443763,
0.00292257103289611, 0.00244711437859726, 0.00200460229907916,
0.00160640112694151, 0.00124780740242907, 0.000937848487830812,
0.000681861181339916, 0.000476378362535685, 0.000324655473916315,
0, 0.000963264, 0.00187008479521078, 0.00272240426958982, 0.00351723225177192,
0.00425831434376975, 0.00494350123060215, 0.00557562330069836,
0.00614450745612511, 0.00665740949107753, 0.00710916654914402,
0.00749848314432814, 0.00782789338871085, 0.00809260936674949,
0.00829672733728848, 0.00841600277242236, 0.00846230434956046,
0.00844240869640363, 0.00832342085802373, 0.00812326122263826,
0.0078508620861086, 0.00749353673161199, 0.00704211435685558,
0.00653307581704423, 0.00596133650624761, 0.00536295605287683,
0.00470425020443496, 0.00406618578489894, 0.00340468087457009,
0.002789011894371, 0.00223499287226645, 0.00173607986424914,
0.00130483267872113, 0.000948676426212058, 0.00066278728700617,
0.000451694572405307, 0, 0.00030102, 0.00058440149850337, 0.000850751334246819,
0.00109913507867873, 0.00133072323242805, 0.00154484413456317,
0.00174238228146824, 0.0019201585800391, 0.00208044046596173,
0.0022216145466075, 0.00234327598260254, 0.00244621668397214,
0.00252894042710922, 0.00259272729290265, 0.00263000086638199,
0.00264447010923765, 0.00263825271762613, 0.00260106901813242,
0.00253851913207446, 0.00245339440190894, 0.00234173022862875,
0.00220066073651737, 0.00204158619282632, 0.00186291765820238,
0.00167592376652401, 0.00147007818888593, 0.00127068305778092,
0.00106396277330315, 0.000871566216990938, 0.000698435272583265,
0.000542524957577857, 0.000407760212100353, 0.000296461383191268,
0.000207121027189428, 0.000141154553876659, 0, 0.00105357, 0.00205526683209511,
0.00300626336368029, 0.00390929969537093, 0.00476486444794536,
0.00557512525789805, 0.00634137695638695, 0.00706540914033929,
0.00774748566063782, 0.00838913612193228, 0.00899131662505551,
0.00955499843030602, 0.0100814495552015, 0.0105716170440972,
0.0110267844116588, 0.0114468897086337, 0.0118328045584424, 0.0121858031997845,
0.0125057717435305, 0.0127936021318254, 0.0130505841656891, 0.013277579615128,
0.0134752511477536, 0.0136454079994793, 0.0137896036441917, 0.01391018923149,
0.0140085115235269, 0.0140875638046839, 0.0141490900281738, 0.0141959364315846,
0.0142308256531358, 0.0142559897967222, 0.0142735318242161, 0.0142853466722778,
0.0142929792784183, 0, 0.00554, 0.0107535747211902, 0.015652091423646,
0.0202185489776578, 0.0244746728930785, 0.0284082888779771, 0.0320358421920919,
0.0352990490891639, 0.0382397829833271, 0.0408285546849597, 0.0430580986394221,
0.044943139059886, 0.0464563478156613, 0.0476214079695113, 0.0482993141884705,
0.0485583867412685, 0.0484376829310943, 0.0477486208032232, 0.0465942245689797,
0.0450259026159578, 0.0429710428032106, 0.0403772277070668, 0.0374538142017196,
0.0341717555224214, 0.0307378656641582, 0.0269591153240065, 0.023299614734674,
0.0195067033838936, 0.0159773229777886, 0.0128019532272718, 0.00994296832277849,
0.00747217819573439, 0.00543195760250571, 0.00379452862928521,
0.00258567760670601, 0, 0.001135, 0.0022137165400495, 0.00323745366711279,
0.00420920110635351, 0.00512952248072957, 0.00600078690824088,
0.00682442237276213, 0.00760238711075745, 0.00833499780443345,
0.00902393034610636, 0.00967024302428446, 0.0102750092507793,
0.0108396196619564, 0.0113651191388567, 0.0118529121597705, 0.0123029597684919,
0.0127162232276225, 0.0130940939281995, 0.0134364758210685, 0.013744349354193,
0.0140191195237827, 0.0142617321661502, 0.0144729193644219, 0.0146546374906482,
0.0148085676522837, 0.0149372406978305, 0.0150421128943951, 0.0151263952325276,
0.0151919629831741, 0.0152418640808977, 0.0152790111704534, 0.0153057910768984,
0.015324450283809, 0.0153370111859407, 0.0153451214641265, 0,
0.001135, 0.00220309275461207, 0.00320661056724482, 0.00414207375790905,
0.00501393649462151, 0.00581970783030296, 0.00656275986086454,
0.00723115567880555, 0.00783347652951274, 0.0083636843914829,
0.00882029395607766, 0.00920632442583286, 0.00951618060427556,
0.00975471668386883, 0.00989346162477442, 0.00994641349383308,
0.0099215755435554, 0.00978032281638279, 0.0095437615478721,
0.00922242459093158, 0.00880144175044886, 0.00827007974061339,
0.00767122237917321, 0.00699892215370464, 0.00629553982622289,
0.00552154089291908, 0.00477198237469738, 0.0039951158307429,
0.00327223837022667, 0.00262187872720241, 0.00203632854248913,
0.00153029240489488, 0.00111244607539997, 0.000777097988120394,
0.00052952651992041, 0, 0.0173, 0.0335862930174351, 0.0488937548417712,
0.0631686826826854, 0.0764783466912671, 0.08878414566455, 0.10013691272806,
0.110353941381557, 0.119565544020789, 0.127678996931466, 0.134671033482905,
0.140587165745525, 0.145341403856851, 0.14900731568406, 0.151149475079425,
0.151981040760784, 0.151623719403801, 0.149486725180024, 0.14589190414221,
0.140999678270629, 0.134582197047629, 0.126474754972263, 0.117332539817605,
0.107064233230022, 0.0963174578462074, 0.0844872522348232, 0.0730277619414321,
0.0611472858220204, 0.0500900124707436, 0.0401399581944405, 0.0311795952630952,
0.0234344949482961, 0.0170380105282338, 0.0119035073097373, 0.00811233068256658,
0, 0.00798093387709187, 0.0172221342253082, 0.0261571268761119,
0.0370239778724022, 0.0480847928139013, 0.0602397578542127, 0.0729061053037527,
0.0879097532689816, 0.103772954507293, 0.121228981040427, 0.140308286316361,
0.160628742635701, 0.182670905097199, 0.205955818516762, 0.232674304512434,
0.261490416150404, 0.291761099892009, 0.326045858051948, 0.362710854324399,
0.401035697341258, 0.441902106311621, 0.485843087451169, 0.530383701240229,
0.575951489659739, 0.620414603209111, 0.665993555491638, 0.708048258677768,
0.74942326221472, 0.786436630178053, 0.818593010075497, 0.846594003866054,
0.870075701935559, 0.88894441816401, 0.903706818735331, 0.914363263232678
), dim = c(36L, 15L), dimnames = list(c("0", "1", "2", "3", "4",
"5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15",
"16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26",
"27", "28", "29", "30", "31", "32", "33", "34", "35"), c("Healthy_noAC",
"Healthy_AC", "IS_mild", "IS_mod", "IS_sev", "IS_dead", "IH_mild",
"IH_mod", "IH_sev", "IH_dead", "MI", "MI_dead", "SE", "MB", "Dead"
)))
I tried using plot_trace(m_M_ad)
The problem is that the plot shows the last two health states as white. How can I change the color?
The trace plotted with plot_trace(m_M_ad)
Does anyone know how to add different colors to that plot? Or maybe how to write a code for plotting that cohort trace another way?
Very thankful for any help!

Related

Get date from string Kusto

Can someone tell me why this does not work?
let x = "July, 2021";
let calculatedTime = replace_string(x,","," 01");
print(todatetime(calculatedTime))
while this works?
let y = todatetime("July 01 2021");
print y
How to get 1st day of the month from a string like "July, 2021"?
The reason that you are seeing this discrepancy is that the constant value in your second query is being parsed by the query string parser using .Net library that supports this format, while the first expression is being evaluated by the query engine which is using different libraries, these libraries supports the datetime formats specified here.
Here is workaround for this issue, most likely this can be written simpler:
let GetMonthNumber = view(Month:string){
case(
Month=="January", "01",
Month=="February", "02",
Month=="March", "03",
Month=="April", "04",
Month=="May", "05",
Month=="June", "06",
Month=="July", "07",
Month=="August", "08",
Month=="September", "09",
Month=="October", "10",
Month=="November", "11",
Month=="December", "12",
"-1" // default case is an error
)};
let x = "July, 2021";
let dateparts = split(x, ",");
let calculatedTime = strcat(replace_string(tostring(dateparts[1]), " ", ""),"-", GetMonthNumber(tostring(dateparts[0])), "-01");
print todatetime(calculatedTime)
print_0
2021-07-01 00:00:00.0000000

Compare automatically all possible combinations (1 vs 1) (1 vs 1+2), etc in a function in R

Following my previous question, and with the same example, I would like to modify the groups in the comparison.
Just to remember, I am running a PLS regression by using geomorph.
This function requires two 3D arrays inside it (A1 and A2), as can be seen in the documentation in the previous link.
Basically the function would be:
two.b.pls(A1, A2, iter = 999)
The point is that I am having 8 different 3D matrix arrays and want to run the PLS analysis for any possible combination.
The difference with my previous question is the type of combinations. My arrays are named Group_1, Group_2... Group_8. I wanted earlier to compare Group_1 vs. Group_2 etc, but now I need to compare all combinations as possible by combining the groups, for instance, Group_1 vs. Group_2+Group_3, etc. What I need is to iteratively explore all possible combinations:
two.b.pls(Group_1, Group_2, iter = 999)
two.b.pls(Group 1, Group 3, iter = 999)
two.b.pls(Group 1, Group 2 + Group 3, iter = 999)
...
two.b.pls(Group_7, Group_8, iter = 999)
Minor comment on the combinations required
Group_1 vs. Group_2 (and all the combinations 1 by 1)
Group_1 vs. Group_2&Group_3 (combined) (and all the combinations 1 by 2)
Group_1 vs. Group_2&Group_3&Group_4 (combined) (and all the combinations 1 by 3)
...
Group_1 vs. Group_2&Group_3&...&Group_8 (combined)
Another set:
Group_1&Group_2 vs. Group_3&Group_4 (combined) (and all the combinations 2 by 2).
...
Group_1&Group_2&Group_3&Group_4 vs. Group_5&Group_6
...
Specifications:
Group_1 vs. Group_2&Group_3 == Group_2&Group_3 vs. Group_1
Group_1 vs. Group_2&Group_3 == Group_1 vs. Group_3&Group_2
3D array as example
Please, download this example. Create Face, Frontal and the other groups with this same dataset. This is the structure of this example num [1:112, 1:3, 1:2]
structure(c(0.0121067537295831, -0.0139329378363627, -0.0128942856218092,
0.00104644154378343, -0.00114530915378115, -0.000607912100374409,
0.00151278447681022, 0.00393687340838906, 0.00621298060827974,
0.00834044621831124, 0.0102092935435389, 0.0115755766569844,
0.0119258892059719, -0.000396743612783844, 0.00185330841923162,
0.00435613976082836, 0.00683328855687188, 0.0093417626098382,
0.0110196500804907, 0.0119338477285669, 0.0122282953973805, 0.00970016937702731,
0.00502149702279466, 6.43342133087913e-05, -0.00492288184466163,
-0.00956756783898905, -0.0135047050650378, -0.0162386438360501,
-0.0182130797956816, -0.0194252658586714, -0.019956478468564,
-0.0195560089784483, -0.0194376122541402, -0.0189496884694952,
-0.0188076982059598, -0.0184481816461359, -0.0178127383586681,
-0.0172051565198613, -0.0162368638401209, -0.0169731739342895,
-0.017597312625215, -0.0180638542635129, -0.0187144293475924,
-0.0189884753925375, -0.0189947938350846, -0.0193729916935741,
-0.0193636556951379, -0.00408430404773437, -0.00664029045820733,
-0.00892836358740464, -0.0106234245916282, -0.0114889308750888,
-0.0123253175220186, -0.00239864086586122, -0.00548067506615771,
-0.00841302150977786, -0.0110588381511544, -0.0125741839608042,
-0.0132378724743151, -0.0143350819811742, -0.0151336998776877,
-0.0163526630884662, -0.0177165720198144, -0.0191285732564418,
-0.019944892329024, -0.0199324039287649, -0.0202185556327263,
-0.0190696924697975, -0.0173547483350903, -0.0159511654761443,
-0.0147291258658671, -0.0137233248776445, -0.0203200694852889,
-0.0184506889252457, -0.0158203449430831, -0.0196266755955667,
-0.0209659699612106, -0.0205698543045638, -0.0183129557213343,
-0.0162673719891882, -0.0204944283453325, -0.0168984523237582,
-0.0172784962660288, -0.0204264167160555, -0.0205440506730952,
-0.0187558434048595, -0.0152092221518476, -0.0203970113196534,
-0.0176357135428962, -0.0193952758042404, -0.0198037508808749,
-0.0203583856042399, -0.0208134667944455, -0.0150492447642772,
-0.0152602566994186, -0.0191844556313852, -0.0175986034747731,
-0.016240690926133, -0.017582868965997, 0.000203505568249415,
-0.00268512269701802, -0.0131454051941203, -0.0125643151022891,
-0.00511531931380859, -0.00203280827772074, 0.00320590657051683,
-0.00626169715789532, -0.000668437780500823, -0.019380055733749,
-0.00446052160041499, -0.0199727808288008, 0.00379018316863347,
9.57128256764846e-05, 0.0176615324865033, -0.0183982515354167,
0.021955722685282, -0.0208609214574232, -0.0216249847657198,
-0.0215160559748617, -0.0202098811465698, -0.0182993603255582,
-0.0153881733371962, -0.0119849076726351, -0.00826706040213423,
-0.00411105738294977, 0.0216232694815021, 0.0212626099454012,
0.0197639705630097, 0.0177457724953735, 0.0151158131692247, 0.0118629656679233,
0.00798339321420489, 0.00403919891236629, 6.93300838151236e-05,
-6.59969168921038e-05, -0.000176322187804505, -0.000214470519799677,
-0.000140138774905899, -6.95124715839799e-05, -6.07152549401866e-05,
-0.000121751691618514, -0.000190949191335675, -0.00420221113412627,
-0.0046546857014779, -0.00590803504983574, -0.00742390203482344,
-0.00955164077502198, -0.0116210651143029, -0.0136246811967233,
-0.0153597202783619, -0.016520473599831, 0.0158209294861601,
0.0144805016874292, 0.0127699288459808, 0.0108665503181813, 0.00880050918667468,
0.00682965250590193, 0.00522906142230795, 0.00398456393406205,
-0.0196649104672861, -0.0186792178514035, -0.0175459563818717,
-0.0173203337783667, -0.017526142565625, -0.0179761177459468,
0.0210626606617924, 0.0197037576394902, 0.0177482641644597, 0.0169824449782621,
0.0171492142644067, 0.0173799507697275, 0.0175807822049577, 0.0166591521159536,
0.0144723059446465, 0.0117073399302622, 0.00836867344687509,
0.00420619178673691, -0.000475512210001711, -0.00513522463858741,
-0.0096513057207465, -0.0129065159907077, -0.0156326089300706,
-0.0177622453535592, -0.0183883852720748, 0.00483575892339502,
0.0109585351836108, 0.0169248421290258, 0.00739883809085566,
-0.000311708220811525, -0.00496356370416955, 0.012671019230947,
-0.0162277686974197, 0.00282026501947482, -0.0165380742333304,
0.0143504752307859, -0.00311853282722531, 0.0013439133424226,
-0.0110193704417722, -0.0179826972534614, 0.00484808074784459,
-0.0144688771464215, -0.0091834907261722, -0.00761739209299819,
-0.00458104863708919, -0.00237537440293526, 0.0177086490258444,
-0.0176924574890119, 0.00933439446690749, -0.0129201731056937,
0.017049918790561, 0.0154059190489952, -0.00725653105931065,
-0.0168114167454652, 0.0173954364309373, -0.0184093777902411,
-0.00692227950521597, 0.0135066524432826, -0.0200377340229696,
-0.0192924918628568, 0.0189953682053652, 0.0065920411043607,
0.0207763069491844, -0.00490970221726531, 0.0070342803679922,
-0.0299656339772703, -0.00781014999662473, -0.00742460195002254,
-0.00852379235397777, -0.00770814329844858, -0.0128968190500875,
-0.0169069261502681, -0.0199654117248723, -0.022833066018448,
-0.0252541610417436, -0.0273094681489095, -0.0289140751399086,
-0.029571942393349, -0.0131156818675002, -0.0168783584731727,
-0.0197229377982092, -0.0222949528843976, -0.0246155933705453,
-0.0270213460442498, -0.0286139332093845, -0.0298522067412257,
-0.0306936892402078, -0.0312245434915385, -0.0311144376344305,
-0.0301558790063451, -0.0283325451325485, -0.0255757771780149,
-0.0221547869099635, -0.0190107068572344, -0.0170655364750566,
-0.0085992823261642, -0.00983147288183302, -0.0113196124238418,
-0.012606851536613, -0.0127016336390267, -0.0121251647817931,
-0.0114146883856852, -0.010295370079425, -0.00886051780892385,
-0.00911491927806971, -0.0103800514545884, -0.0113789519665083,
-0.0120041072141714, -0.0124770003431828, -0.0122568444076323,
-0.0111393316963931, -0.00980229783172321, -0.00757396956404178,
-0.00746826930600419, -0.00753079445983466, -0.00752512063965866,
-0.00748527714103993, -0.00742021392749337, -0.00837814516441945,
-0.00815176012587459, -0.00787115435263527, -0.00777995325147563,
-0.00782374041923372, -0.00785425926668388, -0.00967021213344859,
-0.0118236999226699, -0.0134653423972038, -0.0151978835551724,
-0.0166422891034175, -0.0171478960392589, -0.016908540157026,
-0.0172903692640931, -0.016696130263402, -0.0151145154994161,
-0.0131913922017915, -0.0110621643620987, -0.00906678245018461,
-0.0157232922354404, -0.0143582255771394, -0.0106592633110684,
-0.0157301827812935, -0.0137704426813924, -0.0161561119929206,
-0.0123502372809837, -0.0120404772183872, -0.011205924393612,
-0.0102236037598132, -0.0125646792086793, -0.00985264666590227,
-0.0159946450762133, -0.0134197891804638, -0.00988036482173798,
-0.0129789017819308, -0.0120314631340899, -0.0156257547247481,
-0.0144193728249802, -0.0120215924211333, -0.0157810207816036,
-0.00852616880899861, -0.00788467249309025, -0.01356536007035,
-0.0143121132018561, -0.0083066837625688, -0.0108417415256806,
-0.0301955476848072, -0.0241434062218676, -0.0122943605337793,
-0.00775612886007838, -0.0290228197328159, -0.0259454272736183,
-0.0208885324020887, -0.00853199509771019, -0.021016347241584,
-0.0174833113107165, -0.0132131738700254, -0.0176623249942278,
-0.0303206618263515, 0.0127776364853376, -0.0152452243000105,
-0.0147105852230956, -0.000863874408630801, -0.000209885807261966,
-0.000331581547817195, 0.000501913076487955, 0.00280122318386634,
0.00586278420222562, 0.00884948590623061, 0.0110321835800337,
0.0121504087239398, 0.0126238643777473, -0.00116678400949535,
0.000309098039122892, 0.00274365192850091, 0.00536277214780085,
0.00787276641694412, 0.00994463037319537, 0.0117030008228836,
0.0127848253859643, 0.0102434336168691, 0.00536484343949205,
0.000262677005211979, -0.00475716562751991, -0.0092856945102185,
-0.0131277374842598, -0.0160383460447621, -0.0183311058353516,
-0.0197199548288722, -0.0198559128532786, -0.0198579400897286,
-0.0200326661395768, -0.0194686440260956, -0.019396466558016,
-0.0193168686399384, -0.018836091216227, -0.0184061172416965,
-0.0175896108878106, -0.0182014405947427, -0.0185988791253094,
-0.0187820813333505, -0.0190165366997682, -0.0190174031419613,
-0.0192544802580697, -0.0198412223742528, -0.019758033447168,
-0.00320133118204574, -0.00615476035279051, -0.00937984850181281,
-0.0119227278138075, -0.0134572187644259, -0.014266707013781,
-0.00320248689735123, -0.00593510789800099, -0.00913687701439053,
-0.0121478179417917, -0.0140997195693407, -0.0148624470466123,
-0.0162853478207419, -0.0169558670069506, -0.0171485021492836,
-0.0179293084780989, -0.0189236569302454, -0.0200280979178052,
-0.0201835513258776, -0.0203155932654009, -0.0190617340444641,
-0.0176470469832613, -0.0167847173642825, -0.0162820395311557,
-0.0154790628049744, -0.0204204848345239, -0.0188209658483633,
-0.0175505053387551, -0.0195717677446563, -0.021179463511248,
-0.0208786568169446, -0.019069560636353, -0.0173645780141257,
-0.0206194278230603, -0.0182266456298993, -0.0182349521436495,
-0.0203936090235412, -0.020773374166366, -0.0194125058845639,
-0.0168809938214606, -0.0205941325139531, -0.0185866626526175,
-0.0196528192035162, -0.0202849258298999, -0.0210914618991165,
-0.0210384427398307, -0.0166286873932309, -0.0168834667354705,
-0.0193889694262657, -0.0180990834649523, -0.0177420142623336,
-0.018800405940245, 0.000523501896703479, -0.0029261097264044,
-0.0146321688981797, -0.0145531489430636, -0.00494439965759757,
-0.00284250195686774, 0.00225485514966812, -0.00595669409878074,
-0.00185724176389381, -0.019252019103788, -0.00539562893555244,
-0.0200498867260231, 0.00350463890855844, 0.00100525471102834,
0.017071734313362, -0.0180797098086776, 0.0212141654154872, -0.0213160923807591,
-0.0212957182248067, -0.0214662450855171, -0.0199465405608737,
-0.0182343573421267, -0.0154570896926197, -0.0120083526857707,
-0.00780487511046493, -0.00339017439997714, 0.0209368593999181,
0.020588563526874, 0.01913362662387, 0.0174819046855605, 0.0151727297678676,
0.0120622439286332, 0.00854192437336988, 0.00477549549417729,
0.000959514886792293, 0.00086367959534621, 0.000733910218756855,
0.000556459985315933, 0.000368212110990821, 0.000167290914129546,
-4.96631069309189e-05, -0.000257642952562252, -0.000393942844978405,
-0.00370568556096609, -0.00423737604809828, -0.00562884468972012,
-0.00717879773073304, -0.00924653564959142, -0.0113927508863948,
-0.0134073925813304, -0.015185546576351, -0.0163707369270519,
0.0152290436102138, 0.0138448530426031, 0.01205637447214, 0.0100153951166161,
0.00788519518442069, 0.0057407469258699, 0.00409262353568515,
0.00271017228405623, -0.0198288941212281, -0.0186318757659544,
-0.0172712409469645, -0.0162335941301901, -0.0164126097070513,
-0.0173771169051665, 0.020109104090643, 0.0187101345999028, 0.0167105166543032,
0.0152575143210133, 0.0156886432759352, 0.0165319022262677, 0.0171582245693941,
0.0162280492120763, 0.0141315427138271, 0.0112493507713461, 0.00773343947298834,
0.00371546401835653, -0.000659605057928003, -0.00499491955935594,
-0.0092477714337454, -0.0125017521159196, -0.0151786508806214,
-0.0173865957635562, -0.0181793392041093, 0.0041939912863222,
0.0104873358804602, 0.0166973173151379, 0.00671499620031813,
-0.000587338004291861, -0.00486544441698405, 0.0121136769140914,
-0.0159046406153872, 0.00191901645180105, -0.0163693673725423,
0.0139924440541622, -0.00279045214703507, 0.000952406008266023,
-0.0107832055228765, -0.0179357102553364, 0.00393811167380723,
-0.0142708811035892, -0.00888102060955728, -0.00737323885894898,
-0.00446214895976684, -0.00245190564496676, 0.0172248556504535,
-0.0176757128782511, 0.00863985006836693, -0.0126206510681342,
0.0166394585376546, 0.014952572452408, -0.00657700188211858,
-0.0161911771734234, 0.0161059208508412, -0.0178817032028216,
-0.00629111535992669, 0.0133969495769111, -0.0194959868885208,
-0.0192009607384602, 0.0181259301303218, 0.00600314788573458,
0.0197613597582916, -0.0047787506936498, 0.00745721889807159,
-0.0292291332920766, -0.00812087569534304, -0.00743611172635218,
-0.00885413422418974, -0.00777937002763539, -0.0126982336492491,
-0.0169399947077556, -0.0202311363446088, -0.0229456543081723,
-0.0249878361884412, -0.0269907846948384, -0.0282628825010996,
-0.0290363401578354, -0.0133268120739664, -0.01728453720012,
-0.0200285728729878, -0.0223837116395661, -0.0246147905484459,
-0.0264508728197877, -0.0277270947907398, -0.0286012275090666,
-0.0296560667420954, -0.0302363823717699, -0.0305095608113487,
-0.0297799151195076, -0.0281034022184888, -0.0255680591416587,
-0.0222831548185084, -0.0192325578880546, -0.017138061465351,
-0.00795388801919832, -0.00948551730810068, -0.0109260623825648,
-0.0121071142560424, -0.0122356889667297, -0.0119671852632039,
-0.011443080611894, -0.0103264701670775, -0.00851301891308872,
-0.00931943327911955, -0.0107854794928235, -0.0117606665554891,
-0.0122981126741706, -0.0128417290779904, -0.0125396201596298,
-0.0111872791263485, -0.00944900017887592, -0.00793458358918158,
-0.00786784513235398, -0.00775618523658388, -0.00778342378570517,
-0.00773341111129831, -0.00755905201258847, -0.00867994788574915,
-0.00856767887507999, -0.00839917017153023, -0.00819969133205156,
-0.00814350875744698, -0.00810097879331339, -0.00978077696715094,
-0.012345919771051, -0.014314367742374, -0.0158047140930344,
-0.0171268236313219, -0.0173475238154141, -0.0168777507682366,
-0.0171907904533275, -0.0168079013041868, -0.0155387350270384,
-0.0136071221385007, -0.0114788899879373, -0.00928254793674215,
-0.0159243876515305, -0.0148734801957321, -0.0110391264286132,
-0.0161052792860213, -0.0134551059432601, -0.0159335986419256,
-0.0128237221185521, -0.0122201811479621, -0.0109864014492699,
-0.0100574633053536, -0.0131924278835383, -0.0093236303173408,
-0.0159954096611316, -0.0132487448657675, -0.00997422292451404,
-0.0131129555120115, -0.012091752490751, -0.0154676321043934,
-0.0140171395282845, -0.0116661532536343, -0.015532882738171,
-0.00873293716563884, -0.00712030247295228, -0.0139380125569914,
-0.0145631170966823, -0.00831320298976728, -0.0112506766032763,
-0.0300052299191381, -0.0245186269012974, -0.0126849066479447,
-0.0077783651484388, -0.0291941982398039, -0.0258349210210429,
-0.0209999658365151, -0.00885832257691175, -0.0209788315824288,
-0.0178253431091118, -0.013385631836996, -0.0176249210382204,
-0.029103552012985), .Dim = c(112L, 3L, 2L), .Dimnames = list(
c("11", "21", "23", "61", "64", "147", "148", "149", "150",
"151", "152", "153", "154", "163", "164", "165", "166", "167",
"168", "169", "170", "225", "226", "227", "228", "229", "230",
"231", "232", "233", "382", "383", "384", "385", "386", "387",
"388", "389", "390", "391", "392", "393", "394", "395", "396",
"397", "398", "410", "411", "412", "413", "414", "415", "416",
"417", "418", "419", "420", "421", "486", "487", "488", "489",
"490", "491", "492", "493", "494", "495", "496", "497", "498",
"535", "537", "546", "550", "558", "570", "571", "573", "576",
"584", "586", "591", "593", "594", "597", "605", "614", "630",
"634", "640", "649", "654", "661", "665", "672", "675", "676",
"681", "682", "683", "684", "685", "686", "687", "688", "689",
"690", "691", "692", "693"), c("X", "Y", "Z"), c("Homo sapiens",
"Homo sapiens")))

How to get 'species score' for ordination with metaMDS()?

I am using metaMDS() from Vegan to make an ordination. My data is samples (rows) times variables (columns). In my case the columns are analytes measured i blood, i.e. not 'species' per se. Due to the different scales for my variables I have transformed the data using scale(center = T, scale = T).
It is a numeric matrix with no missing values and no binary variables.
But the function does not calculate scores for 'species' (i.e. my analytes).
And I get the message 'species scores not available'.
I can't find anywhere that these scores should not be calculated when using 'euclidean' distance. I normally get the species score when I use Bray-Curtis distance on a regular community dataset.
plotdf <- structure(c(-0.698904932895234, 0.30704395903274, 1.24113935868014,
2.30332141847988, -0.723897451949346, 0.122724131008669, 0.160212909589836,
0.0446225089645731, 0.39451777572213, -0.105332605360096, -0.892596955564596,
0.338284607850377, 0.178957298880421, 0.15396477982631, 1.61602714449181,
-0.292776498265928, -0.814495333520497, -0.533329494161748, -0.336513406610622,
-0.211550811340068, 3.13524832588293, 2.26119814124526, 1.70180602307717,
1.80669204523371, 3.13524832588293, 1.87661606000469, 1.52699598614965,
2.12135011170326, -1.06718496185488, -1.13361277588734, -0.601897693913475,
-0.328503392807931, 1.46276186573425, 0.00347540139166063, -0.745695995144315,
-0.749246570483348, -0.76344887183948, -0.775875885526096, -0.807831063577394,
0.0869139218589377, -0.832685090950625, -0.0923901327622313,
-0.587695392557344, -0.770550022517546, -0.0107268999644709,
-0.525560324124265, -0.427919502300856, -0.798954625229811, -0.806055775907877,
-0.310750516112765, 3.44444636497001, 0.200147425204428, -0.0244578860101126,
0.200147425204428, -0.36968456806209, -0.398800071367679, -0.120123111157047,
0.408115305958629, -0.890990722485962, -0.961699801942393, -0.273778277609555,
0.41093290575329, 3.181624670989, 3.76548692036815, -0.406474243377552,
0.416240744384011, 0.00222933118786958, -0.427705597900429, -0.268470438978834,
-1.12834029715544, -0.517938854622665, -0.783330786158653, -0.661250497652098,
-0.862948365619448, 0.947024607455987, -0.204776375410201, -0.581632918191303,
-0.348088018439634, 0.368470196707535, -0.188852859518039, 0.865085267987317,
0.286121529607417, 0.570778700977531, 0.382615486004067, 0.821662987608825,
0.44533655766189, 1.25106109357391, 2.8818089566773, -1.44594498771245,
-1.13716432724317, -1.44345540764024, 0.543632464272209, -0.889117589295565,
0.151331854366745, 0.765367591610085, 0.577745560785727, 0.245142869778918,
-1.26436165094427, -0.326251496822513, -1.02556997534963, -0.974400330579358,
-0.778250025626633, 0.466877997116795, -0.539458350031998, -1.07673962011992,
0.867706881150637, 0.0745773872113305, -0.104516369484636, -1.57990779369432,
-0.360364593336031, 0.485255827280768, 3.57337992412814, 0.256505894180964,
-0.264535620101922, 2.13733867744602, 1.79421377779631, 1.52733885584654,
2.07379702936274, -1.15411869326783, 1.20963061543015, -0.278018853200573,
0.884992040049025, 2.17533989241356, 1.52167683562364, 0.137948546574831,
-0.278018853200573, 0.154926807790159, -0.176149285908647, -0.575138424468722,
-0.69398625297599, -0.278018853200573, -0.626073208114692, -0.626073208114692,
-0.736431906014289, 0.307731158728054, -0.294997114415901, -0.855279734521558,
-0.311975375631229, -0.430823204138483, -0.227084069554603, 2.88551074988959,
2.47142262330214, 1.68465518278598, 2.11254624692636, 3.60326350264118,
3.56185468998243, 2.47142262330214, 2.73367843680753, -0.675647138762483,
-0.38578545015127, -0.294373188387428, 2.29466328872395, 6.49068792404239,
2.82139829613626, -0.0622526766464104, 0.535904026686221, 0.0180967312639449,
-0.705047939929233, -0.642553955998955, -0.142602084556756, -0.0711803886364486,
-0.633626244008917, -0.937168451670251, 0.160940123104569, -0.294373188387428,
0.321638938925279, -1.08001184351088, -0.749686499879426, -0.517565988138408,
-0.553276836098561, 0.54926502031515, 1.38672720907941, -0.444646148767711,
-0.987616139285201, -0.407834623986865, -0.49066055474377, -0.923195970918719,
-0.38022598040123, -0.242182762473055, 0.107526722944989, -1.46680807598847,
2.62643635730582, 1.68823363847608, -1.17998610194623, -0.992345558180284,
-0.831510806380897, -2.25489835980544, -0.724287638514648, -1.45876633839851,
-0.295394967049624, 0.428361416047591, -0.375812342949318, 0.669613543746671,
1.17892359111139, 2.46560160550643, 0.750030919646365, -1.77775526280061,
-0.751093430481203, -0.456229718849011, 0.696419335713228, 0.378429058462806,
0.84201157835516, 0.713238656162837, -0.832036410144966, 0.919275331670544,
-0.162417214744905, 0.0178648763243318, 0.172392382955099, -0.342699305814142,
-0.445717643567996, -1.1097816715345, 0.730197996765378, 6.53377023116585,
1.26110122121555, -0.855239029674838, 0.104750362481623, 0.221112713046046,
-0.484334037250749, -0.549787859443237, -1.13887225917561, -0.54251521253296,
-0.498879331071302, -0.964328733328984, 0.301111829059086, 0.337475063610461,
0.0902050686610707, -1.16069019990644, -1.21305325766043, -0.0261572819033443,
-0.797057854392627, -0.140787338747868, 0.441771092401777, -0.470669823856697,
-0.751420875013156, -1.16552867546893, -1.00409682105396, -0.582970244319283,
-0.681233112224038, -0.877758848033557, -0.639120454550571, -0.167969655559799,
2.19329729357675, 5.38160698124336, 4.37477234303285, -0.359747681885611,
0.982698502395062, 0.587156323098077, -0.371733808530972, -0.395706061821705,
-1.59911317701617, -0.563511834856784, -0.851178874345507, -0.659400848019695,
-0.347761555240249, -0.155983528914438, 1.30632392181987, -0.87515112763623,
-0.44365056840315, -0.155983528914438, -0.503581201629967, -0.0537715590349406,
2.47365169616714, 0.150652380724054, 0.531624268456718, 0.420120301315449,
-0.193151517961524, 0.410828304053678, 1.05197611511598, -0.416159452244061,
-0.769255348191411, -0.309794112249109, -0.304271920832414, -0.297815438433252,
-0.297131810885106, -0.309361148135283, -0.307667270988209, -0.308829437820058,
-0.30965738673948, -0.310135926023183, 0.243389703849444, -0.0870302777547278,
-0.307849571667715, -0.309581428123019, -0.308821841958412, -0.307089985503107,
0.0481760595453695, -0.149316343252526, -0.108298690363732, -0.211602408750324,
-0.309323168827053, 1.63254216944839, 0.17253410335763, 0.235865204597817,
-0.283223643067293, -0.304586580610635, -0.306690077901827, -0.306576986649612,
-0.304925854367279, 0.0662283262758862, -0.301442643799068, 0.929605567553241,
2.25902865198899, 4.95029977413941, 2.64812809133604, -0.47547574119999,
-0.432242470161435, -0.302542657045751, -0.464667423440349, -0.464667423440349,
-0.399817516882512, -0.670025460873512, 0.270298184215185, 0.270298184215185,
1.19981351154425, 1.17819687602497, 0.194639959897707, -1.28609957317301,
-0.637600507594599, 0.389189679571229, -0.432242470161435, -0.350014484068485,
0.215408884220155, -0.423765358193087, -0.890854227648913, -0.841686978232511,
-0.534391669379991, -0.645017980566895, -0.595850731150493, -0.80481154117021,
-0.0918864246323654, -0.48374453836672, 4.17862597661995, 5.68911318449899,
3.32268322548848, -0.257171457184862, 0.563526592429426, -0.513954282524298,
-0.77073710786374, -0.977170359607208, -0.443464879489945, -1.01241506112439,
0.0701007711889329, -0.322625902859619, -0.0708780348797788,
0.910938650241606, -0.221926755667683, -0.513954282524298, -0.322625902859619,
0.03989102703135, 0.0902406006273229, -0.0648244445283561, 0.391240413183369,
0.285285951290747, -0.253699789641292, -0.659090774273934, -0.742011657494247,
-0.566956459584699, -0.461001997692076, -0.682124352946243, -0.258306505375753,
-0.420693217666615, 2.40995896415691, 6.42553531511589, 1.48835127705159,
0.161894498824987, 0.665487270707522, 0.994632873245161, 0.105939746393572,
-0.23308022422017, -1.90513988511128, -0.697175523798217, 0.33634166816991,
0.764230951468825, 0.402170788677427, 0.145437218698094, 0.402170788677427,
-0.279160608575437, -0.256120416397798, -0.341698273057587, 0.435085348931185,
0.838074051864222, 1.31633692302975, 0.59894261628146, 0.412951499717062,
0.0409692665883208, -0.657825928503537, 0.333241021189475, 0.120679745115908,
-0.362897157951458, -0.171592009485246, -0.333650770025627, 2.21948894199296,
5.12305959487686, 1.43519112196112, -0.150091705762848, 0.634206114269011,
0.433959862345984, -0.450461083647381, -0.617332960249911, -1.13463577771773,
-0.68408171089092, 1.18488330705733, 0.70095486491002, 0.667580489589508,
0.1502776721217, 0.433959862345984, 9.29831794179632e-05, -0.0332813921410786,
0.116903296801188, 0.484021425326744, 0.807251285728501, 1.62776898417899,
0.652436625643507, 1.10139913989, -0.245488402849498, -0.601562121044994,
0.265399975431007, -0.322895732891995, -0.245488402849498, -0.183562538815489,
-0.171864707173939, 2.88790201225057, 6.25364540361752, 2.77316076027215,
-0.22923533316314, 0.382718010721768, 0.382718010721768, -0.611706173091208,
-0.66907679908041, -1.18541243298329, -0.860312219044444, -0.496964921112788,
-0.22923533316314, 0.172359048761322, 0.688694682664205, 0.191482590757734,
-0.649953257084015, -0.343976585141561, -0.210111791166746, 0.975547812610265,
0.222389325297373, 0.851437956724518, 0.303036585736753, -0.713118895799399,
-0.632471635360019, -1.26152026678716, -0.616342183272147, -0.584083279096402,
-1.03570793755692, -0.245364785251013, 0.00895755191294446, 0.984545704690042,
7.5829220077053, 2.82642375246424, -0.248095758051148, 0.559496924434463,
1.77392201087898, 0.377333161467775, 0.680939433078909, -1.05366439872601,
-0.826971715923037, -0.235951507186702, -0.00521074076224157,
-0.110460914920767, -0.0477156187878014, 0.336852325252967, -0.493004817150792,
-0.177254294675216, -0.316913179616336, -0.377634433938563, -0.422757412167952,
0.295225804994338, -0.0721144456468375, -0.289179139207527, -0.416078498519931,
-0.753363637745003, -0.514592474828243, -0.436115239463994, -0.850207885641312,
-0.239087286847367, -0.00656190873037701, 2.43718215979915, 5.49186224546105,
2.79088195919157, -0.199489072035347, 0.73299221727198, 1.05453748944691,
0.379292417879529, 0.34713789066204, -0.476018006105799, -0.00656190873037701,
-0.0708709631653894, 0.15421072735707, 0.73299221727198, 0.700837690054491,
0.443601472314542, -0.919750481707214, 0.218519781792082, 1.1831555983169,
-0.482448911549298, -0.344507148209773, 0.458909211725853, -0.116463203249896,
-0.463791673265714, 0.0729886894860142, 0.318574476365909, -0.312931832753788,
0.318574476365909, -1.04618082500943, -0.0322623620339359, -0.0384066209005535,
1.53648495801046, 6.52705048079341, 3.16250938039262, 0.749039168554954,
0.45246867642236, 0.697906325083822, -0.2429379947851, -0.263391132173553,
-0.935276695384289, -0.3554302504216, -0.760402370712999, -0.723586723413778,
0.186577890372456, -0.212258288702411, 1.35240672151437, -1.11321899066384,
-1.02015721554638, -0.488375643446552, -0.212258288702411, -0.517689783976593,
-0.517689783976593, -0.404074729996812, -0.716516128441214, -0.678644443781284,
-1.01380885302165, -0.574497310966489, -0.12950501621233, -0.77332365543111,
-0.527157705141571, -0.6329761214973, 2.18318173522514, 4.28249941023639,
0.954312852291706, 0.391081280947224, 0.595892761436129, 1.00551572241394,
0.365479845886108, 0.109465495274971, -0.376961770886163, -0.095345985213934,
1.3383343782084, 1.49194298857507, 1.3383343782084, 0.672697066619453,
-0.095345985213934, -1.62119151485626, -0.607374686436184, 0.467885586130548,
1.38953724833063, -0.651224895277883, 0.155618947409365, -1.0668717233289,
-1.18912079040272, -1.11577135015842, -0.82237358918124, -1.26247023064701,
-0.895723029425547, -1.0668717233289, 0.0333698803355454, -0.052069378070287,
2.73328153457067, 6.5440088820849, 2.54963202384708, -0.113285881644804,
0.162188384440567, 0.529487405887713, -0.453037476483425, -0.296935392368385,
-1.05295921151378, -0.624443686492099, -0.401003448445078, -0.312239518262021,
1.41712670771834, 0.238709013908721, 1.26408544878204, -0.928995791775366,
-0.945830330258361, -0.251023014687489, 0.0397553772915032, -0.592177487733025,
-0.00842427829955308, -0.251023014687489, -0.607339908757271,
-0.856003613554907, -1.00459533959252, -0.763512845307005, -0.53456028784089,
-0.402647224929949, -0.251023014687489, 0.227980242429395, 2.40547844522623,
3.95993525473729, 3.4564674621831, 1.24750252235161, 1.12792892161999,
1.00206197348145, 0.668514560914304, 0.580407697217322, -0.0363403486615505,
-0.137033907172389, 0.523767570554978, 0.731448034983579, -0.181087339020876,
-0.470581319739529, -0.653088394540424, -0.395061150856403, 0.0580598624423623,
0.397900622416433, 0.888781720156762, -0.584336071479825, -0.50609378010719,
-0.40377693754298, -0.295441457180876, -1.1861998512693, -1.37277762300404,
-0.993603441736668, -0.722764740831404, 0.420776440768595, 0.637447401492804,
-0.272315269292895, 2.66941297149803, 7.41532733360265, 3.99900765660126,
0.157956344080792, 0.361088865416019, 1.2474853221515, 0.638087758145851,
0.619621165297205, -0.807846461903923, -0.111655911509586, -0.407121397088085,
-0.259388654298836, -0.0673360886728128, -0.364648233536176,
-0.146742437922033, -0.67858031196333, -0.370188211390772, -0.120889207933915,
0.342622272567355, -0.0607210092437259, 0.0586382429485912, -0.0802880997670564,
-0.246608369215364, -0.248565078267698, -0.589032453373648, -0.305309640785355,
-0.117465571761385, -0.497067127913995, -0.178123552383708, 0.0562843265198969,
1.72321561241497, 4.55261213715794, 1.83288214438177, 0.297550696846829,
0.385283922420244, 0.9555498886475, -0.47011502692064, -0.711381397247572,
-0.996514380361199, 0.385283922420244, 0.911683275860804, 0.385283922420244,
0.802016743894006, 0.363350616026884, 0.626550292747176, 0.122084245699975,
0.780083437500669, 0.451083841600322, 0.9555498886475, 0.318768231003561,
0.715510556440497, 0.219582649644338, 0.358442463547259, -0.157322559520749,
-0.593739117501383, 0.219582649644338, 0.0608857194695682, -0.375530838511066,
-0.196996792064447, -0.652950143413879, 0.625186447640068, 1.98637884605493,
2.40165788285948, -0.832904392695844, -0.558358807252847, -0.648335931893829,
-0.846747027255997, -0.922881517336828, -0.703706470134434, -0.969023632537331,
-0.309191385170126, -0.496066951732166, -0.323034019730277, 0.902039138843094,
-0.043874222767227, -0.355333500370629, -0.0392600112471769,
-0.392247192531032, -1.17897025669963, 2.3237306833112, 3.55022035107835,
1.63689646936162, 1.85766460955969, 3.82004807798711, 3.30492241752492,
1.6859560560723, 1.53877729594025, 0.255869103455813, -0.217555908302303,
0.147043929627318, 1.33013687809435, 1.4455605803838, 2.80178908228503,
-0.689777911971317, 1.73411983610745, 0.810730217791754, -0.545498284109474,
0.0316202273378633, -0.834057539833125, -0.776345688688416, 0.724162441074655,
-0.920625316550224, -0.89176939097787, -0.603210135254218, -0.862913465405515,
0.233611706344417, 0.781874292219364, -0.0838034749516248, -0.603210135254218,
-0.630192299425754, 0.643965453120263, -0.855043667522133, -0.292915247281239,
-1.07989503561849, -1.37969685974697, -0.855043667522133, -1.11737026363455,
0.344163628991805, -0.705142755457904, -0.421112829288472, 1.33922283110583,
5.51499186229142, 4.4040074411503, -0.559028136740472, -0.622239319322639,
-0.421112829288472, -0.250634185354747, -0.354070665943748, -0.817619338212975,
-0.854013655457253, -0.664380107710751, -0.662464617329474, -0.281282031455192,
0.0194499584054227, 0.0941540832752574, -0.827196790119363, -0.817619338212975,
-0.409619887000803, -0.597337944366027, -0.0832549257485097,
0.204960720543472, -0.143804431272036, -0.170446213702386, -0.158336312597682,
-0.20435393679556, 0.277620127171702, 0.476222505288867, -0.642732356785886,
-0.591870772146124, -1.49887064253455, -1.22501683268422, -1.6774709533065,
-0.955131918628824, -0.133570489077839, 1.93025532428696, 0.945969167143749,
0.473670567546803, 0.362541485288701, 1.69212157659102, -0.645558046624104,
2.56527865147613, 1.53336574479373, 1.1483828526853, 2.48590073557747,
0.0251853427194558, 0.807057814321117, 0.830871189090712, 1.49367678684442,
-0.0740370521538533, 0.951792873536318, 2.5032023290554, 0.318564524344853,
0.635178698940584, -0.241842564689589, 0.125429877841457, -0.685102409123612,
0.375555075772084, 0.188752712760605, 0.217247988474217, -0.423761492139935,
0.962684741533591, 4.03514176906493, 4.24637318970771, -0.813579477507975,
-0.264377783836745, -0.441044062919797, -0.723326052324239, -0.560101772736638,
-1.00752832737089, -0.974883471453369, -0.500572917828217, -0.638833484067129,
-0.661876911773614, 0.482613330981802, 0.232976197494883, -0.437203491635383,
-0.375754351084758, -0.421841206497728, -0.88847061755405, 1.20779505745642,
4.21167561465542, 0.750682798752242, 1.07719155496952, 2.10025232445032,
2.1437868252793, 1.42546756160128, 0.990122553311588, -0.270201245687125,
-0.668541928272209, -0.587206054192632, 0.227535614993705, -0.34580111517447,
-1.10019154960626, 1.34403345795275, 1.8268433359891, 1.25350660582093,
1.19315537106641, 0.468940554011867, 0.921574814670944, 3.21492173534361,
0.287886849748252, -0.0742205587790054, -0.315625497797195, 1.58543839697094,
0.378413701880074, -0.858786610588067, -0.526854819438082, 1.10262851893459,
-0.466503584683535, 0.913870401723578, 1.69394221264665, -0.126225346173866,
-0.357357734595538, -1.05075489986049, -0.126225346173866, -0.241791540384716,
0.0760154936950757, -0.299574637490112, 0.0471239451423484, -0.0968113092559779,
0.902046474926439, -1.32907915984528, -1.42862168816586, 0.558796377269263,
-0.405736397147445, 1.27962158234934, -0.203218839529706, -0.347383880545724,
2.03477179719514, 1.34827160188079, 2.03477179719514, 2.03477179719514,
1.00502150422358, 1.86314674836655, 0.0130287219943229, 0.0679487376194715,
1.0393465139893, 0.593121387034955, 0.370008823557797, 1.09287313812892,
2.98712089240292, 0.0437513049925516, 0.364316309562003, 0.0728935781352272,
-0.13110233386351, 0.422600855847354, -0.166073061634724, 0.393458582704678,
0.422600855847354), .Dim = c(30L, 30L), .Dimnames = list(c("2",
"7", "10", "11", "15", "16", "17", "18", "19", "28", "29", "32",
"33", "35", "37", "39", "42", "43", "44", "46", "61", "62", "63",
"64", "66", "67", "68", "69", "71", "72"), c("C0_S", "C2_S",
"C3_S", "C12.DC_S", "C12.1_S", "Ala_S", "Arg_S", "Asn_S", "Cit_S",
"Gln_S", "Gly_S", "His_S", "Ile_S", "Leu_S", "Lys_S", "Orn_S",
"Phe_S", "Pro_S", "Ser_S", "Thr_S", "Trp_S", "Tyr_S", "Val_S",
"Creatinine_S", "Spermidine_S", "t4.OH.Pro_S", "Taurine_S", "total.DMA_S",
"lysoPC.a.C14.0_S", "lysoPC.a.C16.0_S")))
I have tried these to version:
NMDS=metaMDS(plotdf,k=2,trymax=500, distance = "euclidean")
NMDS=metaMDS(daisy(plotdf, metric ="euclidean", stand = F ))
And I get this message:
plot(NMDS)
species scores not available
Is there something I haven't understood for this function, e.g. the negative values when scaling or the choice of distance.. which is causing this problem?
metaMDS finds species scores after the analysis using weighted averages, and these are not well-defined for negative input (as these would imply negative weights). However, if you have used scaled data and Euclidean distances, you can find species scores similarly as in PCA: as fitted vectors. In vegan this would go like this with your example:
NMDS=metaMDS(plotdf,k=2,trymax=500, distance = "euclidean")
envfit(NMDS, plotdf) # species scores

Aggregate contents of array column in Azure Data Explorer

I have some data stored in the customEvents property bag that I want to perform aggregation and analytics on. I'm new to the analytics queries that you can run against AppInsights using the Azure Data Explorer query language and am stuck.
I have a handle on converting the contents of one of the property bag's key-value-pairs into an array of numbers (in the example below, that output is represented by items.
let items = parse_json('{"operation_Id": "12345Z12", "days":[43, 21, 65]}');
print items.operation_Id, items.days;
However, when I need to calculate the average value of the items in the array for each operation_Id, I run into a documentation wall. I've looked at mvexpand, let (using a lambda expression), datatable, using dynamic data types, etc. The blocking issue I've had with using mvexpand is that I want to associate every row in the output correlated with its operation operation_Id, and mvexpand only seems to persist that relationship in the first row. With a datatable, the type doesn't support a pipeline input.
Another common error I've (including from the code sample below is Operator Source Expression should be table or column).
let items = parse_json('{"days":[43, 21, 65]}');
let arraySum = (T:(x: long))
{
T
| summarize sum(x)
};
items
| project days | invoke arraySum()
If necessary, I can perform the aggregation code in JavaScript and only pass the calculated average in the property bag, but it feels like a waste to throw away the raw data values. Is there some obvious calculation or aggregation function that solves this problem?
Both the following options should allow you to calculate the average as you're interested in:
(caveat: this is based on the example you've shown, which may potentially be "dumbed down" to not reflect your real-life scenario, so please clarify in case this isn't helpful):
let items = dynamic({"operation_Id": "12345Z12", "days":[43, 21, 65]});
print operationId = tostring(items.operation_Id), days = items.days
| mvexpand days to typeof(int)
| summarize avg(days) by operationId
// or
let items = dynamic({"operation_Id": "12345Z12", "days":[43, 21, 65]});
print operationId = tostring(items.operation_Id), days = items.days
| project operationId, series_stats_dynamic(days)['avg']
Your second example is indeed invalid (scalars and tabular arguments are not born equal), but could be rewritten as follows:
(same caveat as above)
let items = dynamic({"days":[43, 21, 65]});
let arraySum = (T:(x: long))
{
T
| summarize sum(x)
};
print items
| mvexpand x = items.days to typeof(long)
| invoke arraySum()
// or
let items = dynamic({"days":[43, 21, 65]});
print items
| project sum = series_stats_dynamic(items.days)["avg"] * array_length(items.days)
Updated examples following up the comments provided later on:
datatable (Operation_id:string, customDimensions:dynamic)
[
"MTFfq", dynamic({"siteId": "1", "fileCount": "3", "pendingDays":[15,10,11]}),
"LXVjk", dynamic({"siteId": "2", "fileCount": "1", "pendingDays":[3]}),
"jnySt", dynamic({"siteId": "3", "fileCount": "2", "pendingDays":[7,11]}),
"NoxoX", dynamic({"siteId": "4", "fileCount": "4", "pendingDays":[1,4,3,11]})
]
| mvexpand days = customDimensions.pendingDays to typeof(int)
| summarize avg(days) by Operation_id
// or
datatable (Operation_id:string, customDimensions:dynamic)
[
"MTFfq", dynamic({"siteId": "1", "fileCount": "3", "pendingDays":[15,10,11]}),
"LXVjk", dynamic({"siteId": "2", "fileCount": "1", "pendingDays":[3]}),
"jnySt", dynamic({"siteId": "3", "fileCount": "2", "pendingDays":[7,11]}),
"NoxoX", dynamic({"siteId": "4", "fileCount": "4", "pendingDays":[1,4,3,11]})
]
| project Operation_id, series_stats_dynamic(customDimensions.pendingDays)['avg']
and:
let arraySum = (T:(x: long))
{
T
| summarize sum(x)
};
datatable (Operation_id:string, customDimensions:dynamic)
[
"MTFfq", dynamic({"siteId": "1", "fileCount": "3", "pendingDays":[15,10,11]}),
"LXVjk", dynamic({"siteId": "2", "fileCount": "1", "pendingDays":[3]}),
"jnySt", dynamic({"siteId": "3", "fileCount": "2", "pendingDays":[7,11]}),
"NoxoX", dynamic({"siteId": "4", "fileCount": "4", "pendingDays":[1,4,3,11]})
]
| mvexpand x = customDimensions.pendingDays to typeof(long)
| invoke arraySum()
// or
datatable (Operation_id:string, customDimensions:dynamic)
[
"MTFfq", dynamic({"siteId": "1", "fileCount": "3", "pendingDays":[15,10,11]}),
"LXVjk", dynamic({"siteId": "2", "fileCount": "1", "pendingDays":[3]}),
"jnySt", dynamic({"siteId": "3", "fileCount": "2", "pendingDays":[7,11]}),
"NoxoX", dynamic({"siteId": "4", "fileCount": "4", "pendingDays":[1,4,3,11]})
]
| project Operation_id, sum = series_stats_dynamic(customDimensions.pendingDays)["avg"] * array_length(customDimensions.pendingDays)
Some references for operators/functions used above:
series_stats_dynamic
array_length
mvexpand

Export Plotly Graph in markdown with jupyter notebook

I want to export a notebook with plotly graphs in markdown to put it on my blog, but the Graphs doesn't show when I open the post on my website.
I'm not experienced with javascript, but I can see in the markdown File HTML code related to these graphs, here is an example:
<div id="52c4552b-3ced-4862-859b-5db04f4d3c5a" style="height: 500px; width: 1000px;" class="plotly-graph-div"></div><script type="text/javascript">require(["plotly"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV ||
{};window.PLOTLYENV.BASE_URL="https://plot.ly";Plotly.newPlot("52c4552b-3ced-4862-859b-5db04f4d3c5a", [{"type": "area", "r": [6409, 6019, 7254, 7226, 7625, 8353, 7271, 5100, 8178, 8833, 8123, 7091], "t": ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"], "name": "Total Number of accidents", "marker": {"color": "rgb(106,81,163)"}}, {"type": "area", "r": [697, 602, 761, 786, 794, 839, 714, 565, 802, 813, 802, 729], "t": ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"], "name": "Grave accidents", "marker": {"color": "rgb(158,154,200)"}}], {"title": "Repartition of accidents per Hour", "autosize": false, "width": 1000, "height": 500, "orientation": -90}, {"showLink": true, "linkText": "Export to plot.ly"})});</script>
So what should I do for the graphs to appear correctly ?
Thanks !
I think, You have missed is to add the script tag containing plotly.js, You can read more here. So what you need to do, is to include the below line.
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
Also, I assume you are using plotly.offline to make your plots, so you need to convert the plot to html like so.
import pandas as pd
import numpy as np
import plotly.offline as py_offline
import plotly.graph_objs as go
py_offline.init_notebook_mode()
N = 10
random_x = np.linspace(0, 1, N)
random_y = np.random.randn(N)
trace = go.Scatter(
x = random_x,
y = random_y
)
data = [trace]
py_offline.plot(data, filename='basic-line', include_plotlyjs=False, output_type='div')
This above topic is discussed in detail -> SO Answer
So with this you will get the plot html as a string.
Note: You always should have only one plotly.js, you can either set include_plotlyjs to true and not include the above script tag, or set it to false and use the script tag, but note, that you need to always have only one plotly.js file present.
So the final content that you need to paste in your blog is going to be.
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<div id="22495cec-ac95-42d5-b3b1-4566a5848585" style="height: 100%; width: 100%;" class="plotly-graph-div"></div><script type="text/javascript">window.PLOTLYENV=window.PLOTLYENV || {};window.PLOTLYENV.BASE_URL="https://plot.ly";Plotly.newPlot("22495cec-ac95-42d5-b3b1-4566a5848585", [{"type": "scatter", "x": [0.0, 0.1111111111111111, 0.2222222222222222, 0.3333333333333333, 0.4444444444444444, 0.5555555555555556, 0.6666666666666666, 0.7777777777777777, 0.8888888888888888, 1.0], "y": [-0.2706323284096669, -0.5368085060076518, -0.3650022122835297, 1.0837185699917664, -1.6123886503326845, 1.3256691068338189, -0.31083903066205104, 0.6951190301897303, -1.624361384686101, 1.852523980751262]}], {}, {"showLink": true, "linkText": "Export to plot.ly"})</script>
Please do let me know if your issue is resolved!

Resources