Related
I would like to change the proportion of the graph covered by the "zoom". If we look at the following image we are at a ratio "graph:zoom" around 1:2 I would like instead a ratio 2:1. In other words, what I want is to reduce the height of the zoom. How should I proceed?
Here is my code
require(dplyr)
require(tidyverse)
require(ggforce)
HY <- DebitH %>%
ggplot(aes(x = Date, y = Débit_horaire)) +
geom_point(alpha = 6/10, size = 0.3, color = "blue") +
geom_line(alpha = 4/10, size = 0.5, color = "blue") +
labs(x = "Date", y = "Débit Horaire (m3/s)")+
theme_bw() +
theme(panel.grid.major.y = element_line(color = "grey",
size = 0.25,
linetype = 2),
legend.position = "none") +
facet_zoom(xlim = as.POSIXct(c("2021-01-15 00:00:00","2021-02-15 00:00:00")))
And here you will find a sample of the data
DebitH <-
structure(list(Date = structure(c(1610233200, 1610236800, 1610240400,
1610244000, 1610247600, 1610251200, 1610254800, 1610258400, 1610262000,
1610265600, 1610269200, 1610272800, 1610276400, 1610280000, 1610283600,
1610287200, 1610290800, 1610294400, 1610298000, 1610301600, 1610305200,
1610308800, 1610312400, 1610316000, 1610319600, 1610323200, 1610326800,
1610330400, 1610334000, 1610337600, 1610341200, 1610344800, 1610348400,
1610352000, 1610355600, 1610359200, 1610362800, 1610366400, 1610370000,
1610373600, 1610377200, 1610380800, 1610384400, 1610388000, 1610391600,
1610395200, 1610398800, 1610402400, 1610406000, 1610409600, 1610413200,
1610416800, 1610420400, 1610424000, 1610427600, 1610431200, 1610434800,
1610438400, 1610442000, 1610445600, 1610449200, 1610452800, 1610456400,
1610460000, 1610463600, 1610467200, 1610470800, 1610474400, 1610478000,
1610481600, 1610485200, 1610488800, 1610492400, 1610496000, 1610499600,
1610503200, 1610506800, 1610510400, 1610514000, 1610517600, 1610521200,
1610524800, 1610528400, 1610532000, 1610535600, 1610539200, 1610542800,
1610546400, 1610550000, 1610553600, 1610557200, 1610560800, 1610564400,
1610568000, 1610571600, 1610575200, 1610578800, 1610582400, 1610586000,
1610589600, 1610593200, 1610596800, 1610600400, 1610604000, 1610607600,
1610611200, 1610614800, 1610618400, 1610622000, 1610625600, 1610629200,
1610632800, 1610636400, 1610640000, 1610643600, 1610647200, 1610650800,
1610654400, 1610658000, 1610661600, 1610665200, 1610668800, 1610672400,
1610676000, 1610679600, 1610683200, 1610686800, 1610690400, 1610694000,
1610697600, 1610701200, 1610704800, 1610708400, 1610712000, 1610715600,
1610719200, 1610722800, 1610726400, 1610730000, 1610733600, 1610737200,
1610740800, 1610744400, 1610748000, 1610751600, 1610755200, 1610758800,
1610762400, 1610766000, 1610769600, 1610773200, 1610776800, 1610780400,
1610784000, 1610787600, 1610791200, 1610794800, 1610798400, 1610802000,
1610805600, 1610809200, 1610812800, 1610816400, 1610820000, 1610823600,
1610827200, 1610830800, 1610834400, 1610838000, 1610841600, 1610845200,
1610848800, 1610852400, 1610856000, 1610859600, 1610863200, 1610866800,
1610870400, 1610874000, 1610877600, 1610881200, 1610884800, 1610888400,
1610892000, 1610895600, 1610899200, 1610902800, 1610906400, 1610910000,
1610913600, 1610917200, 1610920800, 1610924400, 1610928000, 1610931600,
1610935200, 1610938800, 1610942400, 1610946000, 1610949600, 1610953200,
1610956800, 1610960400, 1610964000, 1610967600, 1610971200, 1610974800,
1610978400, 1610982000, 1610985600, 1610989200, 1610992800, 1610996400,
1.611e+09, 1611003600, 1611007200, 1611010800, 1611014400, 1611018000,
1611021600, 1611025200, 1611028800, 1611032400, 1611036000, 1611039600,
1611043200, 1611046800, 1611050400, 1611054000, 1611057600, 1611061200,
1611064800, 1611068400, 1611072000, 1611075600, 1611079200, 1611082800,
1611086400, 1611090000, 1611093600, 1611097200, 1611100800, 1611104400,
1611108000, 1611111600, 1611115200, 1611118800, 1611122400, 1611126000,
1611129600, 1611133200, 1611136800, 1611140400, 1611144000, 1611147600,
1611151200, 1611154800, 1611158400, 1611162000, 1611165600, 1611169200,
1611172800, 1611176400, 1611180000, 1611183600, 1611187200, 1611190800,
1611194400, 1611198000, 1611201600, 1611205200, 1611208800, 1611212400,
1611216000, 1611219600, 1611223200, 1611226800, 1611230400, 1611234000,
1611237600, 1611241200, 1611244800, 1611248400, 1611252000, 1611255600,
1611259200, 1611262800, 1611266400, 1611270000, 1611273600, 1611277200,
1611280800, 1611284400, 1611288000, 1611291600, 1611295200, 1611298800,
1611302400, 1611306000, 1611309600, 1611313200, 1611316800, 1611320400,
1611324000, 1611327600, 1611331200, 1611334800, 1611338400, 1611342000,
1611345600, 1611349200, 1611352800, 1611356400, 1611360000, 1611363600,
1611367200, 1611370800, 1611374400, 1611378000, 1611381600, 1611385200,
1611388800, 1611392400, 1611396000, 1611399600, 1611403200, 1611406800,
1611410400, 1611414000, 1611417600, 1611421200, 1611424800, 1611428400,
1611432000, 1611435600, 1611439200, 1611442800, 1611446400, 1611450000,
1611453600, 1611457200, 1611460800, 1611464400, 1611468000, 1611471600,
1611475200, 1611478800, 1611482400, 1611486000, 1611489600, 1611493200,
1611496800, 1611500400, 1611504000, 1611507600, 1611511200, 1611514800,
1611518400, 1611522000, 1611525600, 1611529200, 1611532800, 1611536400,
1611540000, 1611543600, 1611547200, 1611550800, 1611554400, 1611558000,
1611561600, 1611565200, 1611568800, 1611572400, 1611576000, 1611579600,
1611583200, 1611586800, 1611590400, 1611594000, 1611597600, 1611601200,
1611604800, 1611608400, 1611612000, 1611615600, 1611619200, 1611622800,
1611626400, 1611630000, 1611633600, 1611637200, 1611640800, 1611644400,
1611648000, 1611651600, 1611655200, 1611658800, 1611662400, 1611666000,
1611669600, 1611673200, 1611676800, 1611680400, 1611684000, 1611687600,
1611691200, 1611694800, 1611698400, 1611702000, 1611705600, 1611709200,
1611712800, 1611716400, 1611720000, 1611723600, 1611727200, 1611730800,
1611734400, 1611738000, 1611741600, 1611745200, 1611748800, 1611752400,
1611756000, 1611759600, 1611763200, 1611766800, 1611770400, 1611774000,
1611777600, 1611781200, 1611784800, 1611788400, 1611792000, 1611795600,
1611799200, 1611802800, 1611806400, 1611810000, 1611813600, 1611817200,
1611820800, 1611824400, 1611828000, 1611831600, 1611835200, 1611838800,
1611842400, 1611846000, 1611849600, 1611853200, 1611856800, 1611860400,
1611864000, 1611867600, 1611871200, 1611874800, 1611878400, 1611882000,
1611885600, 1611889200, 1611892800, 1611896400, 1611900000, 1611903600,
1611907200, 1611910800, 1611914400, 1611918000, 1611921600, 1611925200,
1611928800, 1611932400, 1611936000, 1611939600, 1611943200, 1611946800,
1611950400, 1611954000, 1611957600, 1611961200, 1611964800, 1611968400,
1611972000, 1611975600, 1611979200, 1611982800, 1611986400, 1611990000,
1611993600, 1611997200, 1612000800, 1612004400, 1612008000, 1612011600,
1612015200, 1612018800, 1612022400, 1612026000, 1612029600, 1612033200,
1612036800, 1612040400, 1612044000, 1612047600, 1612051200, 1612054800,
1612058400, 1612062000, 1612065600, 1612069200, 1612072800, 1612076400,
1612080000, 1612083600, 1612087200, 1612090800, 1612094400, 1612098000,
1612101600, 1612105200, 1612108800, 1612112400, 1612116000, 1612119600,
1612123200, 1612126800, 1612130400, 1612134000, 1612137600, 1612141200,
1612144800, 1612148400, 1612152000, 1612155600, 1612159200, 1612162800,
1612166400, 1612170000, 1612173600, 1612177200, 1612180800, 1612184400,
1612188000, 1612191600, 1612195200, 1612198800, 1612202400, 1612206000,
1612209600, 1612213200, 1612216800, 1612220400, 1612224000, 1612227600,
1612231200, 1612234800, 1612238400, 1612242000, 1612245600, 1612249200,
1612252800, 1612256400, 1612260000, 1612263600, 1612267200, 1612270800,
1612274400, 1612278000, 1612281600, 1612285200, 1612288800, 1612292400,
1612296000, 1612299600, 1612303200, 1612306800, 1612310400, 1612314000,
1612317600, 1612321200, 1612324800, 1612328400, 1612332000, 1612335600,
1612339200, 1612342800, 1612346400, 1612350000, 1612353600, 1612357200,
1612360800, 1612364400, 1612368000, 1612371600, 1612375200, 1612378800,
1612382400, 1612386000, 1612389600, 1612393200, 1612396800, 1612400400,
1612404000, 1612407600, 1612411200, 1612414800, 1612418400, 1612422000,
1612425600, 1612429200, 1612432800, 1612436400, 1612440000, 1612443600,
1612447200, 1612450800, 1612454400, 1612458000, 1612461600, 1612465200,
1612468800, 1612472400, 1612476000, 1612479600, 1612483200, 1612486800,
1612490400, 1612494000, 1612497600, 1612501200, 1612504800, 1612508400,
1612512000, 1612515600, 1612519200, 1612522800, 1612526400, 1612530000,
1612533600, 1612537200, 1612540800, 1612544400, 1612548000, 1612551600,
1612555200, 1612558800, 1612562400, 1612566000, 1612569600, 1612573200,
1612576800, 1612580400, 1612584000, 1612587600, 1612591200, 1612594800,
1612598400, 1612602000, 1612605600, 1612609200, 1612612800, 1612616400,
1612620000, 1612623600, 1612627200, 1612630800, 1612634400, 1612638000,
1612641600, 1612645200, 1612648800, 1612652400, 1612656000, 1612659600,
1612663200, 1612666800, 1612670400, 1612674000, 1612677600, 1612681200,
1612684800, 1612688400, 1612692000, 1612695600, 1612699200, 1612702800,
1612706400, 1612710000, 1612713600, 1612717200, 1612720800, 1612724400,
1612728000, 1612731600, 1612735200, 1612738800, 1612742400, 1612746000,
1612749600, 1612753200, 1612756800, 1612760400, 1612764000, 1612767600,
1612771200, 1612774800, 1612778400, 1612782000, 1612785600, 1612789200,
1612792800, 1612796400, 1612800000, 1612803600, 1612807200, 1612810800,
1612814400, 1612818000, 1612821600, 1612825200, 1612828800, 1612832400,
1612836000, 1612839600, 1612843200, 1612846800, 1612850400, 1612854000,
1612857600, 1612861200, 1612864800, 1612868400, 1612872000, 1612875600,
1612879200, 1612882800, 1612886400, 1612890000, 1612893600, 1612897200,
1612900800, 1612904400, 1612908000, 1612911600, 1612915200, 1612918800,
1612922400, 1612926000, 1612929600, 1612933200, 1612936800, 1612940400,
1612944000, 1612947600, 1612951200, 1612954800, 1612958400, 1612962000,
1612965600, 1612969200, 1612972800, 1612976400, 1612980000, 1612983600,
1612987200, 1612990800, 1612994400, 1612998000, 1613001600, 1613005200,
1613008800, 1613012400, 1613016000, 1613019600, 1613023200, 1613026800,
1613030400, 1613034000, 1613037600, 1613041200, 1613044800, 1613048400,
1613052000, 1613055600, 1613059200, 1613062800, 1613066400, 1613070000,
1613073600, 1613077200, 1613080800, 1613084400, 1613088000, 1613091600,
1613095200, 1613098800, 1613102400, 1613106000, 1613109600, 1613113200,
1613116800, 1613120400, 1613124000, 1613127600, 1613131200, 1613134800,
1613138400, 1613142000, 1613145600, 1613149200, 1613152800, 1613156400,
1613160000, 1613163600, 1613167200, 1613170800, 1613174400, 1613178000,
1613181600, 1613185200, 1613188800, 1613192400, 1613196000, 1613199600,
1613203200, 1613206800, 1613210400, 1613214000, 1613217600, 1613221200,
1613224800, 1613228400, 1613232000, 1613235600, 1613239200, 1613242800,
1613246400, 1613250000, 1613253600, 1613257200, 1613260800, 1613264400,
1613268000, 1613271600, 1613275200, 1613278800, 1613282400, 1613286000,
1613289600, 1613293200, 1613296800, 1613300400, 1613304000, 1613307600,
1613311200, 1613314800, 1613318400, 1613322000, 1613325600, 1613329200,
1613332800, 1613336400, 1613340000, 1613343600, 1613347200, 1613350800,
1613354400, 1613358000, 1613361600, 1613365200, 1613368800, 1613372400,
1613376000, 1613379600, 1613383200, 1613386800, 1613390400, 1613394000,
1613397600, 1613401200, 1613404800, 1613408400, 1613412000, 1613415600,
1613419200, 1613422800, 1613426400, 1613430000, 1613433600, 1613437200,
1613440800, 1613444400, 1613448000, 1613451600, 1613455200, 1613458800,
1613462400, 1613466000, 1613469600, 1613473200, 1613476800, 1613480400,
1613484000, 1613487600, 1613491200, 1613494800, 1613498400, 1613502000,
1613505600, 1613509200, 1613512800, 1613516400, 1613520000, 1613523600,
1613527200, 1613530800, 1613534400, 1613538000, 1613541600, 1613545200,
1613548800, 1613552400, 1613556000, 1613559600, 1613563200, 1613566800,
1613570400, 1613574000, 1613577600, 1613581200, 1613584800, 1613588400,
1613592000, 1613595600, 1613599200, 1613602800, 1613606400, 1613610000,
1613613600, 1613617200, 1613620800, 1613624400, 1613628000, 1613631600,
1613635200, 1613638800, 1613642400, 1613646000, 1613649600, 1613653200,
1613656800, 1613660400, 1613664000, 1613667600, 1613671200, 1613674800,
1613678400, 1613682000, 1613685600, 1613689200, 1613692800, 1613696400,
1613700000, 1613703600, 1613707200, 1613710800, 1613714400, 1613718000,
1613721600, 1613725200, 1613728800, 1613732400, 1613736000, 1613739600,
1613743200, 1613746800, 1613750400, 1613754000, 1613757600, 1613761200,
1613764800, 1613768400, 1613772000, 1613775600, 1613779200, 1613782800,
1613786400, 1613790000, 1613793600, 1613797200, 1613800800, 1613804400,
1613808000, 1613811600, 1613815200, 1613818800, 1613822400, 1613826000,
1613829600, 1613833200, 1613836800, 1613840400, 1613844000, 1613847600,
1613851200, 1613854800, 1613858400, 1613862000, 1613865600, 1613869200,
1613872800, 1613876400, 1613880000, 1613883600, 1613887200, 1613890800,
1613894400, 1613898000, 1613901600, 1613905200, 1613908800, 1613912400,
1613916000, 1613919600, 1613923200, 1613926800, 1613930400, 1613934000,
1613937600, 1613941200, 1613944800, 1613948400, 1613952000, 1613955600,
1613959200, 1613962800, 1613966400, 1613970000, 1613973600, 1613977200,
1613980800, 1613984400, 1613988000, 1613991600, 1613995200, 1613998800,
1614002400, 1614006000, 1614009600, 1614013200, 1614016800, 1614020400,
1614024000, 1614027600, 1614031200, 1614034800, 1614038400, 1614042000,
1614045600, 1614049200, 1614052800, 1614056400, 1614060000, 1614063600,
1614067200, 1614070800, 1614074400, 1614078000, 1614081600, 1614085200,
1614088800, 1614092400, 1614096000, 1614099600, 1614103200, 1614106800,
1614110400, 1614114000, 1614117600, 1614121200, 1614124800, 1614128400,
1614132000, 1614135600, 1614139200, 1614142800, 1614146400, 1614150000,
1614153600, 1614157200, 1614160800, 1614164400, 1614168000, 1614171600,
1614175200, 1614178800, 1614182400, 1614186000, 1614189600, 1614193200,
1614196800, 1614200400, 1614204000, 1614207600, 1614211200, 1614214800,
1614218400, 1614222000, 1614225600, 1614229200, 1614232800, 1614236400,
1614240000, 1614243600, 1614247200, 1614250800, 1614254400, 1614258000,
1614261600, 1614265200, 1614268800, 1614272400, 1614276000, 1614279600,
1614283200, 1614286800, 1614290400, 1614294000, 1614297600, 1614301200,
1614304800, 1614308400, 1614312000, 1614315600, 1614319200, 1614322800,
1614326400, 1614330000, 1614333600, 1614337200, 1614340800, 1614344400,
1614348000, 1614351600, 1614355200, 1614358800, 1614362400, 1614366000,
1614369600, 1614373200, 1614376800, 1614380400, 1614384000, 1614387600,
1614391200, 1614394800, 1614398400, 1614402000, 1614405600, 1614409200,
1614412800, 1614416400, 1614420000, 1614423600, 1614427200, 1614430800,
1614434400, 1614438000, 1614441600, 1614445200, 1614448800, 1614452400,
1614456000, 1614459600, 1614463200, 1614466800, 1614470400, 1614474000,
1614477600, 1614481200, 1614484800, 1614488400, 1614492000, 1614495600,
1614499200, 1614502800, 1614506400, 1614510000, 1614513600, 1614517200,
1614520800, 1614524400, 1614528000, 1614531600, 1614535200, 1614538800,
1614542400, 1614546000, 1614549600, 1614553200, 1614556800, 1614560400,
1614564000, 1614567600, 1614571200, 1614574800, 1614578400, 1614582000,
1614585600, 1614589200, 1614592800, 1614596400, 1614600000, 1614603600,
1614607200, 1614610800, 1614614400, 1614618000, 1614621600, 1614625200,
1614628800, 1614632400, 1614636000, 1614639600, 1614643200, 1614646800,
1614650400, 1614654000, 1614657600, 1614661200, 1614664800, 1614668400,
1614672000, 1614675600, 1614679200, 1614682800, 1614686400, 1614690000,
1614693600, 1614697200, 1614700800, 1614704400, 1614708000, 1614711600,
1614715200, 1614718800, 1614722400, 1614726000, 1614729600, 1614733200,
1614736800, 1614740400, 1614744000, 1614747600, 1614751200, 1614754800,
1614758400, 1614762000, 1614765600, 1614769200, 1614772800, 1614776400,
1614780000, 1614783600, 1614787200, 1614790800, 1614794400, 1614798000,
1614801600, 1614805200, 1614808800, 1614812400, 1614816000, 1614819600,
1614823200, 1614826800, 1614830400, 1614834000, 1614837600, 1614841200,
1614844800, 1614848400, 1614852000, 1614855600, 1614859200, 1614862800,
1614866400, 1614870000, 1614873600, 1614877200, 1614880800, 1614884400,
1614888000, 1614891600, 1614895200, 1614898800), tzone = "UTC", class = c("POSIXct",
"POSIXt")), Débit_horaire = c(5.052, 5.036, 5.009, 4.982, 4.958,
4.937, 4.917, 4.885, 4.858, 4.834, 4.804, 4.786, 4.769, 4.753,
4.741, 4.722, 4.713, 4.702, 4.689, 4.68, 4.669, 4.664, 4.658,
4.645, 4.623, 4.595, 4.567, 4.539, 4.51, 4.48, 4.443, 4.413,
4.381, 4.352, 4.327, 4.318, 4.291, 4.27, 4.268, 4.268, 4.265,
4.257, 4.254, 4.258, 4.27, 4.283, 4.295, 4.299, 4.303, 4.307,
4.305, 4.308, 4.32, 4.334, 4.355, 4.396, 4.457, 4.531, 4.624,
4.738, 4.879, 5.057, 5.28, 5.558, 5.863, 6.186, 6.562, 6.958,
7.327, 7.555, 7.638, 7.638, 7.577, 7.452, 7.291, 7.089, 6.867,
6.646, 6.469, 6.301, 6.161, 6.043, 5.946, 5.872, 5.807, 5.752,
5.702, 5.67, 5.658, 5.65, 5.647, 5.656, 5.692, 5.74, 5.786, 5.839,
5.91, 6.003, 6.124, 6.256, 6.374, 6.489, 6.596, 6.686, 6.72,
6.725, 6.706, 6.684, 6.646, 6.61, 6.578, 6.568, 6.554, 6.54,
6.529, 6.535, 6.538, 6.542, 6.553, 6.531, 6.547, 6.54, 6.534,
6.51, 6.504, 6.486, 6.462, 6.444, 6.429, 6.412, 6.395, 6.373,
6.365, 6.354, 6.344, 6.334, 6.326, 6.315, 6.303, 6.295, 6.295,
6.298, 6.296, 6.298, 6.289, 6.273, 6.258, 6.238, 6.225, 6.219,
6.21, 6.213, 6.216, 6.216, 6.22, 6.222, 6.229, 6.233, 6.236,
6.239, 6.238, 6.248, 6.258, 6.271, 6.292, 6.311, 6.33, 6.342,
6.348, 6.358, 6.36, 6.365, 6.366, 6.359, 6.353, 6.342, 6.333,
6.327, 6.33, 6.327, 6.319, 6.326, 6.332, 6.324, 6.34, 6.356,
6.373, 6.402, 6.443, 6.487, 6.537, 6.571, 6.582, 6.582, 6.563,
6.54, 6.515, 6.478, 6.442, 6.41, 6.372, 6.331, 6.304, 6.277,
6.246, 6.218, 6.205, 6.199, 6.193, 6.186, 6.187, 6.203, 6.233,
6.274, 6.315, 6.362, 6.4, 6.432, 6.459, 6.484, 6.512, 6.539,
6.544, 6.548, 6.543, 6.529, 6.525, 6.593, 6.638, 6.713, 6.831,
6.968, 7.142, 7.37, 7.656, 7.924, 8.117, 8.181, 8.262, 8.273,
8.25, 8.243, 8.183, 8.13, 8.073, 8.021, 7.953, 7.888, 7.819,
7.765, 7.733, 7.703, 7.675, 7.663, 7.661, 7.673, 7.701, 7.739,
7.8, 7.843, 7.902, 7.973, 8.06, 8.136, 8.216, 8.342, 8.429, 8.585,
8.694, 8.838, 9.026, 9.38, 9.815, 10.294, 10.786, 11.347, 11.859,
12.233, 12.637, 12.966, 13.283, 13.685, 13.908, 14.334, 14.721,
15.149, 15.581, 16.521, 17.244, 17.842, 18.501, 19.313, 20.18,
20.831, 21.707, 22.559, 23.352, 24.222, 25.223, 25.933, 26.78,
27.336, 28.231, 28.845, 29.255, 29.805, 30.559, 30.458, 30.79,
30.01, 30.098, 29.579, 29.405, 29.149, 28.992, 28.879, 28.596,
28.513, 27.866, 27.839, 27.721, 27.259, 27.385, 26.951, 26.759,
26.467, 26.188, 25.971, 25.564, 25.572, 25.392, 25.243, 25.029,
24.91, 24.723, 24.44, 24.286, 24.039, 23.907, 23.594, 23.454,
23.31, 23.152, 22.881, 22.773, 22.481, 22.202, 21.956, 21.718,
21.385, 21.212, 20.804, 20.526, 20.251, 19.879, 19.599, 19.357,
19.033, 18.914, 18.647, 18.546, 18.301, 18.163, 17.975, 17.763,
17.563, 17.43, 17.19, 17.061, 16.821, 16.673, 16.518, 16.312,
16.137, 16.007, 15.833, 15.698, 15.528, 15.349, 15.195, 15.025,
14.867, 14.718, 14.57, 14.357, 14.224, 14.021, 13.917, 13.79,
13.584, 13.405, 13.267, 13.115, 13, 12.925, 12.786, 12.678, 12.518,
12.44, 12.342, 12.221, 12.138, 12.006, 11.919, 11.84, 11.776,
11.701, 11.605, 11.54, 11.484, 11.371, 11.321, 11.252, 11.177,
11.123, 11.066, 11.028, 10.961, 10.917, 10.842, 10.808, 10.706,
10.66, 10.588, 10.534, 10.496, 10.439, 10.434, 10.407, 10.393,
10.326, 10.289, 10.243, 10.188, 10.134, 10.09, 10.07, 10.039,
10.089, 10.19, 10.407, 10.695, 11.179, 11.769, 12.402, 13.126,
13.95, 14.598, 15.244, 15.748, 16.186, 16.655, 16.938, 17.177,
17.321, 17.365, 17.337, 17.256, 17.256, 17.163, 17.1, 17.143,
17.363, 17.495, 17.883, 18.542, 19.075, 19.628, 20.129, 20.61,
20.944, 21.508, 22.023, 22.557, 23.16, 23.827, 24.4, 24.849,
25.24, 25.387, 25.282, 25.309, 25.296, 25.562, 25.898, 26, 26.274,
26.225, 26.295, 26.394, 26.274, 26.071, 26.072, 26.035, 26.211,
26.383, 26.303, 26.501, 26.474, 26.513, 26.728, 26.825, 27.036,
27.121, 27.443, 27.65, 27.775, 27.689, 27.79, 28.197, 27.82,
28.144, 27.998, 27.789, 27.686, 26.934, 26.954, 26.612, 26.222,
26.192, 25.722, 25.616, 25.531, 25.292, 25.189, 24.797, 24.832,
24.664, 24.525, 24.343, 24.419, 24.284, 24.044, 24.054, 23.818,
23.651, 23.619, 23.587, 23.589, 23.397, 23.314, 23.144, 22.834,
22.846, 22.571, 22.437, 22.204, 22.036, 21.734, 21.588, 21.283,
21.018, 20.798, 20.394, 20.138, 19.926, 19.679, 19.477, 19.19,
18.914, 18.683, 18.514, 18.243, 18.11, 17.981, 17.873, 17.723,
17.655, 17.56, 17.496, 17.444, 17.353, 17.342, 17.289, 17.221,
17.182, 17.05, 16.966, 16.87, 16.649, 16.514, 16.457, 16.305,
16.172, 16.121, 16.223, 16.198, 16.412, 16.695, 16.984, 17.443,
17.808, 18.403, 19.015, 19.509, 19.919, 20.47, 20.922, 21.258,
21.561, 21.636, 21.557, 21.321, 21.223, 20.979, 20.834, 20.559,
20.501, 20.434, 20.312, 20.226, 20.08, 19.971, 19.846, 19.8,
19.712, 19.652, 19.59, 19.502, 19.442, 19.378, 19.261, 19.197,
19.193, 19.159, 19.119, 19.053, 18.966, 18.916, 18.877, 18.774,
18.71, 18.623, 18.501, 18.422, 18.277, 18.145, 18.057, 17.947,
17.828, 17.73, 17.56, 17.472, 17.347, 17.187, 17.019, 16.896,
16.784, 16.676, 16.496, 16.395, 16.255, 16.154, 16.125, 16.037,
15.981, 15.889, 15.897, 15.811, 15.786, 15.723, 15.584, 15.535,
15.433, 15.333, 15.291, 15.213, 15.091, 15.02, 14.928, 14.845,
14.804, 14.916, 15.406, 15.627, 16, 16.414, 16.809, 17.147, 17.457,
17.723, 17.973, 18.175, 18.371, 18.551, 18.613, 18.581, 18.389,
18.036, 17.58, 17.179, 16.751, 16.425, 16.129, 15.928, 15.791,
15.61, 15.487, 15.389, 15.363, 15.355, 15.312, 15.326, 15.301,
15.324, 15.291, 15.266, 15.184, 15.102, 15.056, 15.008, 14.947,
14.899, 14.84, 14.82, 14.819, 14.781, 14.766, 14.768, 14.715,
14.696, 14.631, 14.54, 14.455, 14.344, 14.209, 14.103, 14.027,
13.931, 13.848, 13.769, 13.662, 13.611, 13.493, 13.424, 13.358,
13.286, 13.232, 13.132, 13.034, 12.98, 12.937, 12.86, 12.76,
12.694, 12.604, 12.561, 12.466, 12.361, 12.257, 12.138, 12.025,
11.95, 11.863, 11.767, 11.675, 11.554, 11.473, 11.38, 11.287,
11.198, 11.125, 11.074, 11.007, 10.96, 10.906, 10.85, 10.768,
10.693, 10.62, 10.513, 10.435, 10.33, 10.226, 10.147, 10.045,
9.956, 9.844, 9.758, 9.669, 9.596, 9.542, 9.488, 9.453, 9.423,
9.359, 9.331, 9.332, 9.307, 9.279, 9.242, 9.204, 9.147, 9.079,
8.982, 8.892, 8.814, 8.74, 8.659, 8.602, 8.531, 8.45, 8.412,
8.35, 8.284, 8.243, 8.202, 8.168, 8.133, 8.111, 8.08, 8.062,
8.044, 8.024, 8.007, 7.975, 7.924, 7.867, 7.782, 7.71, 7.624,
7.544, 7.463, 7.373, 7.297, 7.233, 7.166, 7.103, 7.052, 7.024,
6.985, 6.938, 6.917, 6.914, 6.909, 6.893, 6.9, 6.903, 6.917,
6.891, 6.853, 6.803, 6.749, 6.694, 6.639, 6.565, 6.483, 6.42,
6.37, 6.32, 6.282, 6.252, 6.226, 6.204, 6.214, 6.215, 6.166,
6.155, 6.134, 6.133, 6.158, 6.175, 6.181, 6.175, 6.167, 6.148,
6.116, 6.082, 6.046, 6.019, 5.983, 5.962, 5.933, 5.912, 5.891,
5.864, 5.85, 5.831, 5.822, 5.806, 5.806, 5.813, 5.828, 5.856,
5.876, 5.907, 5.931, 5.97, 6.023, 6.055, 6.072, 6.069, 6.06,
6.052, 6.028, 6.015, 5.987, 5.965, 5.937, 5.902, 5.869, 5.836,
5.798, 5.77, 5.756, 5.767, 5.812, 5.869, 5.935, 6.029, 6.119,
6.188, 6.235, 6.292, 6.332, 6.383, 6.455, 6.575, 6.634, 6.617,
6.543, 6.441, 6.336, 6.241, 6.162, 6.08, 6.011, 5.942, 5.885,
5.83, 5.785, 5.756, 5.729, 5.691, 5.666, 5.628, 5.581, 5.531,
5.478, 5.431, 5.383, 5.327, 5.278, 5.23, 5.193, 5.159, 5.119,
5.086, 5.057, 5.034, 5.016, 4.995, 4.912, 4.963, 4.987, 5.019,
5.099, 5.21, 5.313, 5.476, 5.692, 5.883, 6.152, 6.457, 6.633,
6.623, 6.445, 6.218, 5.996, 5.813, 5.667, 5.548, 5.461, 5.379,
5.303, 5.24, 5.168, 5.122, 5.078, 5.044, 5.004, 4.973, 4.943,
4.911, 4.875, 4.848, 4.823, 4.794, 4.772, 4.75, 4.727, 4.711,
4.693, 4.668, 4.652, 4.639, 4.627, 4.617, 4.608, 4.593, 4.573,
4.56, 4.549, 4.544, 4.541, 4.532, 4.512, 4.504, 4.493, 4.474,
4.465, 4.45, 4.438, 4.417, 4.407, 4.396, 4.387, 4.381, 4.375,
4.361, 4.351, 4.337, 4.334, 4.33, 4.325, 4.32, 4.311, 4.312,
4.305, 4.291, 4.274, 4.257, 4.248, 4.233, 4.23, 4.222, 4.216,
4.215, 4.2, 4.19, 4.184, 4.177, 4.172, 4.161, 4.152, 4.145, 4.141,
4.136, 4.133, 4.126, 4.114, 4.099, 4.087, 4.078, 4.064, 4.05,
4.043, 4.035, 4.025, 4.013, 4.002, 3.989, 3.979, 3.97, 3.966,
3.958, 3.943, 3.94, 3.932, 3.928, 3.918, 3.91, 3.901, 3.88, 3.874,
3.866, 3.849, 3.831, 3.818, 3.804, 3.795, 3.787, 3.781, 3.779,
3.773, 3.767, 3.763, 3.757, 3.754, 3.751, 3.745, 3.738, 3.729,
3.731, 3.724, 3.723, 3.72, 3.72, 3.709, 3.707, 3.709, 3.707,
3.685, 3.668, 3.667, 3.682, 3.671, 3.652, 3.644, 3.635, 3.632,
3.626, 3.617, 3.614, 3.604, 3.598, 3.591, 3.586, 3.58, 3.578,
3.57, 3.564, 3.558, 3.547, 3.534, 3.524, 3.514, 3.499, 3.481,
3.476, 3.459, 3.449, 3.44, 3.43, 3.414, 3.41, 3.411, 3.417, 3.431,
3.455, 3.496, 3.53, 3.568, 3.604, 3.645, 3.685, 3.717, 3.728,
3.727, 3.69, 3.635, 3.592, 3.558, 3.52, 3.498, 3.472, 3.44, 3.413,
3.393, 3.37, 3.353, 3.321, 3.287, 3.261, 3.24, 3.237, 3.23, 3.227,
3.225, 3.223, 3.233, 3.242, 3.247, 3.234, 3.208, 3.181, 3.154,
3.134, 3.123, 3.109, 3.097, 3.091, 3.091, 3.085, 3.08, 3.074,
3.073, 3.07, 3.046, 3.052, 3.053, 3.049, 3.046, 3.029, 3.028,
3.018, 3.003, 2.997, 2.981, 2.971, 2.957, 2.946, 2.937, 2.931,
2.926, 2.916, 2.907, 2.904, 2.893, 2.887, 2.876, 2.866, 2.861,
2.854, 2.851, 2.85, 2.855, 2.865, 2.86, 2.859, 2.855, 2.843,
2.838, 2.828, 2.806, 2.793, 2.782, 2.775, 2.77, 2.759, 2.752,
2.744, 2.737, 2.729, 2.723, 2.719, 2.711, 2.703, 2.693, 2.697,
2.7, 2.699, 2.695, 2.693, 2.693, 2.692, 2.69, 2.681, 2.67, 2.658,
2.642, 2.637, 2.63, 2.623, 2.614, 2.611, 2.604, 2.604, 2.598,
2.591, 2.593, 2.594, 2.591, 2.585, 2.602, 2.601, 2.597, 2.59,
2.583, 2.582, 2.569, 2.562, 2.551, 2.544, 2.536, 2.537, 2.523,
2.516, 2.513, 2.515, 2.516, 2.516, 2.519, 2.518, 2.517, 2.516,
2.52, 2.534, 2.566, 2.607, 2.625, 2.675, 2.703, 2.742, 2.782,
2.827, 2.956)), class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA,
-1297L))
You could set the size of the zoom panel relative to the main plot via the argument zoom.size which defaults to 2, i.e. the zoom panel is twice the size of the main panel. Hence, to achieve your desired result set zoom.size=.5:
require(dplyr)
require(tidyverse)
require(ggforce)
DebitH %>%
ggplot(aes(x = Date, y = Débit_horaire)) +
geom_point(alpha = 6 / 10, size = 0.3, color = "blue") +
geom_line(alpha = 4 / 10, size = 0.5, color = "blue") +
labs(x = "Date", y = "Débit Horaire (m3/s)") +
theme_bw() +
theme(
panel.grid.major.y = element_line(
color = "grey",
size = 0.25,
linetype = 2
),
legend.position = "none"
) +
facet_zoom(xlim = as.POSIXct(c("2021-01-15 00:00:00", "2021-02-15 00:00:00")), zoom.size = .5)
I would like to implement an (easy) automatic lane / band detection for thin layer chromatography in R. Below I have the rawdata and an image for a not-so-clean square wave signal that represent several bands.
The following image shows the wave and (introduced by hand) start (blue) and stop (red) of a lane.
I would like to automatically determine:
How many lanes are there? (in this example: 9)
How broad are they?
what is the distance between lanes?
also: what is the center of each lane would/could be helpful
Any strategy on how to achieve this in R would be highly welcome. A "rough" estimation of the values for the questions above would already help, as the "precise" values could later be manually adjusted. But the automatically determined values should be somewhat near the actual values, of course.
So far I tried a peak detection using the pracma-package, but this wasn't really useful as I have a square-wave-like signal, not a sharp peak... But maybe I missed something?
Here is the original raw data:
a1 <-c(305.91, 219.13, 117.2, 35.92, -4.89, -9.72, -0.34, 0.67, -15.81,
-42.09, -61.73, -62.25, -43.29, -15.69, 6.4, 14.45, 9.44, -0.57,
-6.75, -5.25, 0.96, 4.55, -1.1, -17.24, -38.05, -52.97, -52.16,
-32.31, 0.65, 34.12, 55.7, 60.34, 53.11, 45.13, 45.36, 53.58,
60.06, 52.48, 25.47, -14.03, -49.77, -65.91, -56.74, -29.88,
-0.87, 16.9, 19.89, 14.68, 11.42, 15.44, 23.25, 25.29, 13.3,
-13.08, -44.98, -68.97, -74.62, -60.26, -33.6, -7.01, 9.42, 13.02,
8.98, 5.86, 9.19, 17.13, 21.35, 12.71, -11.49, -43.9, -69.95,
-76.04, -58.01, -24.17, 9.41, 28.69, 29.92, 20.83, 14.06, 17.41,
27.93, 34.07, 24.37, -3.49, -39.75, -67.82, -74.25, -56.8, -25.3,
4.69, 21.34, 22.66, 16, 11.65, 15.07, 23.04, 25.92, 14.53, -12.82,
-47.78, -75.72, -83.84, -68.64, -38.22, -7.6, 10.16, 11.43, 3.18,
-2.93, 0.37, 10.2, 15.29, 4.32, -24.87, -61.99, -89.58, -93.53,
-71.9, -35.99, -3.03, 14.36, 14.91, 7.51, 3.53, 8.38, 18.02,
22.33, 12.73, -11.41, -41.52, -64.3, -69.08, -53.5, -24.72, 4.7,
23.57, 27.96, 22.7, 17.69, 20.8, 31.89, 42.05, 39.24, 17.06,
-19.32, -54.78, -73.28, -68.27, -47.01, -24.84, -13, -8.96, 2.88,
39.23, 102.66, 174.58, 222.62, 219)
I have used hclust in the TSclust package to do agglomerative hierarchical clustering. My question is, Can I get the dissimlarity (distance) matrix back from hclust? I wanted the values of the distance to rank which variable is closer to a single variable in the group of variables.
example: If (x1,x2, x3,x4,x5,x6,x7,x8,x9,x10) are the variables used to form the distance matrix, then what I wanted is the distance between x3 and the rest of variables (x3x1,x3x2,x3x4,x3x5, and so on). Can we do that? Here is the code and reproducible data.
Data:
structure(list(x1 = c(186.41, 100.18, 12.3, 14.38, 25.97, 0.06,
0, 6.17, 244.06, 19.26, 256.18, 255.69, 121.88, 75, 121.45, 11.34,
34.68, 3.09, 34.3, 26.13, 111.31), x2 = c(327.2, 8.05, 4.23,
6.7, 3.12, 1.91, 37.03, 39.17, 140.06, 83.72, 263.29, 261.22,
202.48, 23.27, 2.87, 7.17, 14.48, 3.41, 5.95, 70.56, 91.58),
x3 = c(220.18, 126.14, 98.59, 8.56, 0.5, 0.9, 17.45, 191.1,
164.64, 224.36, 262.86, 237.75, 254.88, 42.05, 9.12, 0.04,
12.22, 0.61, 61.86, 114.08, 78.94), x4 = c(90.74, 26.11,
47.86, 10.86, 3.74, 23.69, 61.79, 68.12, 87.92, 171.76, 260.98,
266.62, 96.27, 57.15, 78.89, 16.73, 6.59, 49.44, 57.21, 202.2,
67.17), x5 = c(134.09, 27.06, 7.44, 4.53, 17, 47.66, 95.96,
129.53, 40.23, 157.37, 172.61, 248.56, 160.84, 421.94, 109.93,
22.77, 2.11, 49.18, 64.13, 52.61, 180.87), x6 = c(173.17,
46.68, 6.54, 3.05, 0.35, 0.12, 5.09, 72.46, 58.19, 112.31,
233.77, 215.82, 100.63, 65.84, 2.69, 0.01, 3.63, 12.93, 66.55,
28, 61.74), x7 = c(157.22, 141.81, 19.98, 116.18, 16.55,
122.3, 62.67, 141.84, 78.3, 227.27, 340.22, 351.38, 147.73,
0.3, 56.12, 33.2, 5.51, 54.4, 82.98, 152.66, 218.26), x8 = c(274.08,
51.92, 54.86, 15.37, 0.31, 0.05, 36.3, 162.04, 171.78, 181.39,
310.73, 261.55, 237.99, 123.99, 1.92, 0.74, 0.23, 18.51,
7.68, 65.55, 171.33), x9 = c(262.71, 192.34, 2.75, 21.68,
1.69, 3.92, 0.09, 9.33, 120.36, 282.92, 236.7, 161.59, 255.44,
126.44, 7.63, 2.04, 1.02, 0.12, 5.87, 146.25, 134.11), x10 = c(82.71,
44.09, 1.52, 2.63, 4.38, 28.64, 168.43, 80.62, 20.36, 39.29,
302.31, 247.52, 165.73, 18.27, 2.67, 1.77, 23.13, 53.47,
53.14, 46.61, 86.29)), class = "data.frame", row.names = c(NA,
-21L))
Code:
as.ts(cdata)
library(dplyr) # data wrangling
library(ggplot2) # grammar of graphics
library(ggdendro) # dendrograms
library(TSclust) # cluster time series
cluster analysis
dist_ts <- TSclust::diss(SERIES = t(cdata), METHOD = "INT.PER") # note the data frame must be transposed
hc <- stats::hclust(dist_ts, method="complete") # method can be also "average" or diana (for DIvisive ANAlysis Clustering)
hcdata <- ggdendro::dendro_data(hc)
names_order <- hcdata$labels$label
# Use the following to remove labels from dendogram so not doubling up - but good for checking hcdata$labels$label <- ""
hcdata%>%ggdendro::ggdendrogram(., rotate=FALSE, leaf_labels=FALSE)
I believe the object you are looking for is stored in the variable dist_ts:
dist_ts <- TSclust::diss(SERIES = t(cdata), METHOD = "INT.PER")
print(dist_ts)
I have a large time series of actual and forecasted electricity generation values for each quarter of the hour, that looks like this:
df<-structure(list(DATETIME = structure(c(1604188800, 1604189700,
1604190600, 1604191500, 1604192400, 1604193300, 1604194200, 1604195100,
1604196000, 1604196900, 1604197800, 1604198700, 1604199600, 1604200500,
1604201400, 1604202300, 1604203200, 1604204100, 1604205000, 1604205900,
1604206800, 1604207700, 1604208600, 1604209500, 1604210400, 1604211300,
1604212200, 1604213100, 1604214000, 1604214900, 1604215800, 1604216700,
1604217600, 1604218500, 1604219400, 1604220300, 1604221200, 1604222100,
1604223000, 1604223900, 1604224800, 1604225700, 1604226600, 1604227500,
1604228400, 1604229300, 1604230200, 1604231100, 1604232000, 1604232900,
1604233800, 1604234700, 1604235600, 1604236500, 1604237400, 1604238300,
1604239200, 1604240100, 1604241000, 1604241900, 1604242800, 1604243700,
1604244600, 1604245500, 1604246400, 1604247300, 1604248200, 1604249100,
1604250000, 1604250900, 1604251800, 1604252700, 1604253600, 1604254500,
1604255400, 1604256300, 1604257200, 1604258100, 1604259000, 1604259900,
1604260800, 1604261700, 1604262600, 1604263500, 1604264400, 1604265300,
1604266200, 1604267100, 1604268000, 1604268900, 1604269800, 1604270700,
1604271600, 1604272500, 1604273400, 1604274300, 1604275200, 1604276100,
1604277000, 1604277900, 1604278800, 1604279700, 1604280600, 1604281500,
1604282400, 1604283300, 1604284200, 1604285100, 1604286000, 1604286900,
1604287800, 1604288700, 1604289600, 1604290500, 1604291400, 1604292300,
1604293200, 1604294100, 1604295000, 1604295900, 1604296800, 1604297700,
1604298600, 1604299500, 1604300400, 1604301300, 1604302200, 1604303100,
1604304000, 1604304900, 1604305800, 1604306700, 1604307600, 1604308500,
1604309400, 1604310300, 1604311200, 1604312100, 1604313000, 1604313900,
1604314800, 1604315700, 1604316600, 1604317500, 1604318400, 1604319300,
1604320200, 1604321100, 1604322000, 1604322900, 1604323800, 1604324700,
1604325600, 1604326500, 1604327400, 1604328300, 1604329200, 1604330100,
1604331000, 1604331900, 1604332800, 1604333700, 1604334600, 1604335500,
1604336400, 1604337300, 1604338200, 1604339100, 1604340000, 1604340900,
1604341800, 1604342700, 1604343600, 1604344500, 1604345400, 1604346300,
1604347200, 1604348100, 1604349000, 1604349900, 1604350800, 1604351700,
1604352600, 1604353500, 1604354400, 1604355300, 1604356200, 1604357100,
1604358000, 1604358900, 1604359800, 1604360700, 1604361600, 1604362500,
1604363400, 1604364300, 1604365200, 1604366100, 1604367000, 1604367900,
1604368800, 1604369700, 1604370600, 1604371500, 1604372400, 1604373300,
1604374200, 1604375100, 1604376000, 1604376900, 1604377800, 1604378700,
1604379600, 1604380500, 1604381400, 1604382300, 1604383200, 1604384100,
1604385000, 1604385900, 1604386800, 1604387700, 1604388600, 1604389500,
1604390400, 1604391300, 1604392200, 1604393100, 1604394000, 1604394900,
1604395800, 1604396700, 1604397600, 1604398500, 1604399400, 1604400300,
1604401200, 1604402100, 1604403000, 1604403900, 1604404800, 1604405700,
1604406600, 1604407500, 1604408400, 1604409300, 1604410200, 1604411100,
1604412000, 1604412900, 1604413800, 1604414700, 1604415600, 1604416500,
1604417400, 1604418300, 1604419200, 1604420100, 1604421000, 1604421900,
1604422800, 1604423700, 1604424600, 1604425500, 1604426400, 1604427300,
1604428200, 1604429100, 1604430000, 1604430900, 1604431800, 1604432700,
1604433600, 1604434500, 1604435400, 1604436300, 1604437200, 1604438100,
1604439000, 1604439900, 1604440800, 1604441700, 1604442600, 1604443500,
1604444400, 1604445300, 1604446200, 1604447100, 1604448000, 1604448900,
1604449800, 1604450700, 1604451600, 1604452500, 1604453400, 1604454300,
1604455200, 1604456100, 1604457000, 1604457900, 1604458800, 1604459700,
1604460600, 1604461500, 1604462400, 1604463300, 1604464200, 1604465100,
1604466000, 1604466900, 1604467800, 1604468700, 1604469600, 1604470500,
1604471400, 1604472300, 1604473200, 1604474100, 1604475000, 1604475900,
1604476800, 1604477700, 1604478600, 1604479500, 1604480400, 1604481300,
1604482200, 1604483100, 1604484000, 1604484900, 1604485800, 1604486700,
1604487600, 1604488500, 1604489400, 1604490300, 1604491200, 1604492100,
1604493000, 1604493900, 1604494800, 1604495700, 1604496600, 1604497500,
1604498400, 1604499300, 1604500200, 1604501100, 1604502000, 1604502900,
1604503800, 1604504700, 1604505600, 1604506500, 1604507400, 1604508300,
1604509200, 1604510100, 1604511000, 1604511900, 1604512800, 1604513700,
1604514600, 1604515500, 1604516400, 1604517300, 1604518200, 1604519100,
1604520000, 1604520900, 1604521800, 1604522700, 1604523600, 1604524500,
1604525400, 1604526300, 1604527200, 1604528100, 1604529000, 1604529900,
1604530800, 1604531700, 1604532600, 1604533500, 1604534400, 1604535300,
1604536200, 1604537100, 1604538000, 1604538900, 1604539800, 1604540700,
1604541600, 1604542500, 1604543400, 1604544300, 1604545200, 1604546100,
1604547000, 1604547900, 1604548800, 1604549700, 1604550600, 1604551500,
1604552400, 1604553300, 1604554200, 1604555100, 1604556000, 1604556900,
1604557800, 1604558700, 1604559600, 1604560500, 1604561400, 1604562300,
1604563200, 1604564100, 1604565000, 1604565900, 1604566800, 1604567700,
1604568600, 1604569500, 1604570400, 1604571300, 1604572200, 1604573100,
1604574000, 1604574900, 1604575800, 1604576700, 1604577600, 1604578500,
1604579400, 1604580300, 1604581200, 1604582100, 1604583000, 1604583900,
1604584800, 1604585700, 1604586600, 1604587500, 1604588400, 1604589300,
1604590200, 1604591100, 1604592000, 1604592900, 1604593800, 1604594700,
1604595600, 1604596500, 1604597400, 1604598300, 1604599200, 1604600100,
1604601000, 1604601900, 1604602800, 1604603700, 1604604600, 1604605500,
1604606400, 1604607300, 1604608200, 1604609100, 1604610000, 1604610900,
1604611800, 1604612700, 1604613600, 1604614500, 1604615400, 1604616300,
1604617200, 1604618100, 1604619000, 1604619900, 1604620800, 1604621700,
1604622600, 1604623500, 1604624400, 1604625300, 1604626200, 1604627100,
1604628000, 1604628900, 1604629800, 1604630700, 1604631600, 1604632500,
1604633400, 1604634300, 1604635200, 1604636100, 1604637000, 1604637900,
1604638800, 1604639700, 1604640600, 1604641500, 1604642400, 1604643300,
1604644200, 1604645100, 1604646000, 1604646900, 1604647800, 1604648700,
1604649600, 1604650500, 1604651400, 1604652300, 1604653200, 1604654100,
1604655000, 1604655900, 1604656800, 1604657700, 1604658600, 1604659500,
1604660400, 1604661300, 1604662200, 1604663100, 1604664000, 1604664900,
1604665800, 1604666700, 1604667600, 1604668500, 1604669400, 1604670300,
1604671200, 1604672100, 1604673000, 1604673900, 1604674800, 1604675700,
1604676600, 1604677500, 1604678400, 1604679300, 1604680200, 1604681100,
1604682000, 1604682900, 1604683800, 1604684700, 1604685600, 1604686500,
1604687400, 1604688300, 1604689200, 1604690100, 1604691000, 1604691900,
1604692800, 1604693700, 1604694600, 1604695500, 1604696400, 1604697300,
1604698200, 1604699100, 1604700000, 1604700900, 1604701800, 1604702700,
1604703600, 1604704500, 1604705400, 1604706300, 1604707200, 1604708100,
1604709000, 1604709900, 1604710800, 1604711700, 1604712600, 1604713500,
1604714400, 1604715300, 1604716200, 1604717100, 1604718000, 1604718900,
1604719800, 1604720700, 1604721600, 1604722500, 1604723400, 1604724300,
1604725200, 1604726100, 1604727000, 1604727900, 1604728800, 1604729700,
1604730600, 1604731500, 1604732400, 1604733300, 1604734200, 1604735100,
1604736000, 1604736900, 1604737800, 1604738700, 1604739600, 1604740500,
1604741400, 1604742300, 1604743200, 1604744100, 1604745000, 1604745900,
1604746800, 1604747700, 1604748600, 1604749500, 1604750400, 1604751300,
1604752200, 1604753100, 1604754000, 1604754900, 1604755800, 1604756700,
1604757600, 1604758500, 1604759400, 1604760300, 1604761200, 1604762100,
1604763000, 1604763900, 1604764800, 1604765700, 1604766600, 1604767500,
1604768400, 1604769300, 1604770200, 1604771100, 1604772000, 1604772900,
1604773800, 1604774700, 1604775600, 1604776500, 1604777400, 1604778300,
1604779200, 1604780100, 1604781000, 1604781900, 1604782800, 1604783700,
1604784600, 1604785500, 1604786400, 1604787300, 1604788200, 1604789100,
1604790000, 1604790900, 1604791800, 1604792700), class = c("POSIXct",
"POSIXt"), tzone = "UTC"), Actual = c(5.718, 5.844, 5.971, 5.925,
5.414, 5.432, 5.521, 5.513, 5.524, 6.182, 6.947, 7.133, 7.746,
7.058, 6.615, 9.665, 12.015, 12.029, 11.957, 12.981, 16.03, 16.821,
16.897, 15.383, 14.029, 14.642, 10.721, 9.187, 8.466, 6.89, 5.916,
7.977, 11.577, 12.432, 14.191, 14.655, 16.77, 17.376, 16.656,
16.659, 16.249, 15.771, 15.969, 15.623, 14.488, 14.506, 14.37,
13.399, 11.806, 10.78, 9.962, 10.093, 8.922, 10.099, 9.832, 8.406,
7.077, 6.514, 5.942, 6.502, 5.731, 5.276, 7.513, 7.141, 6.74,
6.36, 7.061, 8.619, 8.845, 9.808, 9.702, 10.079, 8.703, 7.287,
7.239, 7.768, 7.338, 7.11, 6.975, 7.35, 6.209, 6.441, 6.641,
5.892, 5.148, 4.533, 4.223, 3.89, 3.498, 2.941, 3.06, 3.244,
3.521, 3.703, 3.314, 3.507, 3.705, 3.073, 2.472, 2.344, 2.695,
2.729, 2.652, 2.582, 2.731, 2.759, 2.866, 3.283, 3.138, 3.009,
3.126, 3.389, 3.205, 3.39, 3.942, 4.029, 4.186, 4.282, 4.335,
4.026, 3.863, 3.772, 3.25, 3.282, 3.332, 3.18, 2.929, 3.054,
3.579, 3.886, 3.145, 2.984, 3.305, 3.535, 3.59, 4.079, 4.141,
3.957, 3.786, 3.505, 3.101, 2.892, 2.501, 2.243, 2.151, 1.96,
1.907, 1.911, 1.901, 1.96, 1.854, 1.88, 2.25, 2.252, 2.154, 2.11,
2.081, 2.27, 2.545, 2.864, 2.854, 3.257, 3.8, 4.158, 3.732, 3.771,
4.19, 4.964, 4.323, 5.286, 4.407, 4.795, 5.225, 5.726, 5.732,
5.836, 6.799, 6.322, 6.262, 5.851, 5.172, 5.007, 5.641, 5.812,
4.964, 4.531, 5.07, 5.403, 5.176, 5.122, 5.618, 6.368, 5.941,
6.191, 6.094, 6.703, 6.977, 6.391, 6.664, 6.671, 6.65, 6.687,
7.659, 8.364, 8.088, 7.329, 7.634, 7.981, 8.941, 8.922, 8.898,
8.921, 8.65, 9.39, 8.253, 7.656, 7.588, 6.226, 5.269, 4.915,
4.918, 4.594, 4.873, 4.414, 4.384, 3.967, 3.432, 3.287, 3.48,
3.374, 3.476, 4.54, 6.395, 6.67, 6.094, 5.212, 5.289, 4.99, 4.113,
3.32, 3.09, 2.25, 2.42, 2.812, 2.544, 2.466, 2.892, 3.04, 2.665,
2.303, 2.162, 1.896, 1.704, 1.683, 1.788, 1.841, 2.162, 2.288,
2.108, 1.943, 1.582, 1.347, 1.256, 1.301, 1.649, 1.615, 1.669,
1.855, 1.952, 2.354, 2.513, 2.314, 2.314, 2.623, 2.646, 2.655,
2.795, 2.829, 3.225, 3.759, 4.926, 6.119, 6.206, 6.608, 6.237,
5.74, 6.116, 8.257, 9.366, 9.073, 8.124, 6.595, 5, 4.428, 4.25,
4.662, 6.04, 7.415, 6.713, 6.646, 6.287, 6.502, 6.023, 5.789,
6.211, 7.477, 8.396, 9.687, 11.208, 9.911, 9.085, 8.758, 8.411,
8.321, 8.393, 8.796, 9.682, 9.908, 9.637, 10.39, 11.094, 12.521,
15.086, 14.875, 15.56, 15.396, 15.365, 16.238, 17.188, 17.16,
17.902, 15.802, 14.354, 12.045, 11.883, 12.716, 13.031, 11.346,
12.645, 13.082, 14.082, 14.606, 15.297, 15.215, 14.762, 15.61,
17.65, 17.997, 17.933, 17.884, 17.323, 17.169, 19.862, 23.073,
25.928, 27.872, 28.236, 30.207, 29.643, 28.742, 28.017, 25.973,
26.97, 28.061, 26.099, 25.133, 23.174, 20.483, 19.969, 21.094,
23.736, 26.382, 29.764, 33.129, 36.769, 38.491, 35.788, 35.61,
37.34, 35.794, 35.368, 34.635, 33.84, 33.404, 32.614, 30.159,
32.87, 33.89, 34.26, 33.309, 34.895, 34.596, 35.942, 37.642,
38.688, 39.047, 39.552, 40.228, 41.329, 42.208, 43.073, 41.838,
40.083, 40.6, 41.215, 41.782, 41.454, 41.65, 42.493, 42.297,
42.925, 43.51, 42.537, 42.897, 42.832, 42.54, 43.833, 44.497,
43.118, 42.778, 41.69, 40.37, 40.367, 43.267, 44.982, 46.84,
46.205, 46.376, 43.302, 40.977, 41.712, 42.041, 42.881, 43.467,
43.469, 45.591, 42.482, 45.196, 44.643, 43.234, 43.791, 45.037,
44.114, 43.488, 42.825, 41.382, 41.102, 39.78, 40.251, 40.823,
41.788, 43.272, 42.782, 41.288, 42.616, 44.222, 47.462, 48.783,
48.18, 48.067, 47.608, 46.76, 49.739, 47.404, 47.416, 44.787,
46.945, 49.951, 51.052, 50.017, 51.615, 51.965, 53.686, 54.802,
57.408, 57.979, 57.367, 57.363, 53.659, 50.096, 47.254, 43.275,
43.44, 42.811, 43.405, 47.903, 51.26, 52.405, 55.277, 54.637,
54.626, 54.327, 53.697, 53.366, 54.955, 52.65, 51.526, 52.107,
53.781, 50.12, 51.497, 54.426, 55.57, 54.662, 50.37, 54.62, 58.996,
60.24, 57.378, 56.576, 56.589, 58.439, 59.768, 59.263, 56.691,
59.286, 59.953, 60.097, 55.379, 49.2, 46.915, 52.828, 53.813,
52.989, 53.829, 53.209, 54.683, 55.321, 56.154, 55.016, 54.061,
53.296, 53.772, 52.342, 51.84, 52.607, 53.034, 54.727, 55.591,
54.567, 53.198, 50.51, 49.453, 49.908, 48.499, 47.923, 49.602,
48.64, 51.539, 52.353, 51.426, 50.687, 48.629, 46.685, 48.598,
48.944, 48.143, 46.887, 47.518, 46.229, 45.746, 46.078, 47.155,
46.933, 49.07, 49.243, 48.567, 48.352, 48.28, 48.954, 49.512,
48.704, 49.681, 50.053, 50.957, 49.603, 47.978, 50, 50.963, 50.415,
50.266, 50.155, 50.662, 51.918, 53.166, 52.792, 54.156, 55.07,
53.702, 54.07, 54.098, 54.46, 53.783, 54.023, 53.997, 55.079,
54.819, 54.935, 53.642, 54.181, 54.903, 56.18, 56.016, 55.307,
53.558, 52.03, 54.562, 58.919, 58.351, 57.536, 59.128, 60.585,
60.938, 60.858, 60.539, 59.114, 57.326, 58.094, 58.355, 58.507,
57.85, 55.829, 57.801, 59.946, 58.755, 56.767, 55.223, 55.452,
58.029, 60.207, 60.816, 60.403, 59.365, 58.132, 57.989, 59.469,
58.991, 58.748, 58.43, 57.926, 58.671, 58.192, 58.335, 58.222,
58.802, 58.458, 58.537, 59.014, 59.015, 57.656, 56.055, 53.788,
54.659, 53.911, 54.722, 56.387, 57.327, 57.251, 57.596, 56.207,
54.747, 53.934, 55.108, 55.669, 57.554, 57.824, 56.961, 54.605,
54.705, 54.599, 54.044, 53.627), Forecasted = c(4.843, 4.843,
4.843, 4.843, 3.695, 3.695, 3.695, 3.695, 3.313, 3.313, 3.313,
3.313, 3.198, 3.198, 3.198, 3.198, 3.74, 3.74, 3.74, 3.74, 5.115,
5.115, 5.115, 5.115, 7.01, 7.01, 7.01, 7.01, 9.236, 9.236, 9.236,
9.236, 16.695, 16.695, 16.695, 16.695, 28.66, 28.66, 28.66, 28.66,
34.778, 34.778, 34.778, 34.778, 35.03, 35.03, 35.03, 35.03, 32.805,
32.805, 32.805, 32.805, 28.593, 28.593, 28.593, 28.593, 22.283,
22.283, 22.283, 22.283, 19.164, 19.164, 19.164, 19.164, 17.839,
17.839, 17.839, 17.839, 15.454, 15.454, 15.454, 15.454, 12.195,
12.195, 12.195, 12.195, 8.568, 8.568, 8.568, 8.568, 7.477, 7.477,
7.477, 7.477, 6.314, 6.314, 6.314, 6.314, 5.763, 5.763, 5.763,
5.763, 4.615, 4.615, 4.615, 4.615, 3.57, 3.57, 3.57, 3.57, 3.438,
3.438, 3.438, 3.438, 3.618, 3.618, 3.618, 3.618, 2.983, 2.983,
2.983, 2.983, 2.513, 2.513, 2.513, 2.513, 2.075, 2.075, 2.075,
2.075, 2.015, 2.015, 2.015, 2.015, 2.315, 2.315, 2.315, 2.315,
2.325, 2.325, 2.325, 2.325, 2.363, 2.363, 2.363, 2.363, 2.058,
2.058, 2.058, 2.058, 1.455, 1.455, 1.455, 1.455, 1.878, 1.878,
1.878, 1.878, 2.165, 2.165, 2.165, 2.165, 2.633, 2.633, 2.633,
2.633, 3.279, 3.279, 3.279, 3.279, 2.935, 2.935, 2.935, 2.935,
2.833, 2.833, 2.833, 2.833, 2.89, 2.89, 2.89, 2.89, 3.952, 3.952,
3.952, 3.952, 4.037, 4.037, 4.037, 4.037, 4.311, 4.311, 4.311,
4.311, 4.242, 4.242, 4.242, 4.242, 2.478, 2.478, 2.478, 2.478,
6.285, 6.285, 6.285, 6.285, 6.803, 6.803, 6.803, 6.803, 7.54,
7.54, 7.54, 7.54, 8.383, 8.383, 8.383, 8.383, 8.86, 8.86, 8.86,
8.86, 8.65, 8.65, 8.65, 8.65, 8.11, 8.11, 8.11, 8.11, 7.783,
7.783, 7.783, 7.783, 6.995, 6.995, 6.995, 6.995, 5.98, 5.98,
5.98, 5.98, 5.22, 5.22, 5.22, 5.22, 5.023, 5.023, 5.023, 5.023,
7.343, 7.343, 7.343, 7.343, 7.29, 7.29, 7.29, 7.29, 7.315, 7.315,
7.315, 7.315, 7.63, 7.63, 7.63, 7.63, 7.875, 7.875, 7.875, 7.875,
7.993, 7.993, 7.993, 7.993, 5.315, 5.315, 5.315, 5.315, 5.787,
5.787, 5.787, 5.787, 5.097, 5.097, 5.097, 5.097, 6.878, 6.878,
6.878, 6.878, 6.337, 6.337, 6.337, 6.337, 4.025, 4.025, 4.025,
4.025, 2.665, 2.665, 2.665, 2.665, 4.573, 4.573, 4.573, 4.573,
6.248, 6.248, 6.248, 6.248, 5.534, 5.534, 5.534, 5.534, 6.268,
6.268, 6.268, 6.268, 5.964, 5.964, 5.964, 5.964, 5.23, 5.23,
5.23, 5.23, 7.155, 7.155, 7.155, 7.155, 9.775, 9.775, 9.775,
9.775, 12.565, 12.565, 12.565, 12.565, 11.868, 11.868, 11.868,
11.868, 11.473, 11.473, 11.473, 11.473, 10.698, 10.698, 10.698,
10.698, 12.933, 12.933, 12.933, 12.933, 13.148, 13.148, 13.148,
13.148, 12.845, 12.845, 12.845, 12.845, 11.588, 11.588, 11.588,
11.588, 16.374, 16.374, 16.374, 16.374, 19.543, 19.543, 19.543,
19.543, 21.938, 21.938, 21.938, 21.938, 22.425, 22.425, 22.425,
22.425, 22.738, 22.738, 22.738, 22.738, 28.695, 28.695, 28.695,
28.695, 29.352, 29.352, 29.352, 29.352, 34.76, 34.76, 34.76,
34.76, 31.81, 31.81, 31.81, 31.81, 33.791, 33.791, 33.791, 33.791,
35.23, 35.23, 35.23, 35.23, 35.308, 35.308, 35.308, 35.308, 35.13,
35.13, 35.13, 35.13, 37.11, 37.11, 37.11, 37.11, 37.073, 37.073,
37.073, 37.073, 40.596, 40.596, 40.596, 40.596, 40.7, 40.7, 40.7,
40.7, 45.062, 45.062, 45.062, 45.062, 43.892, 43.892, 43.892,
43.892, 44.33, 44.33, 44.33, 44.33, 42.638, 42.638, 42.638, 42.638,
45.95, 45.95, 45.95, 45.95, 50.997, 50.997, 50.997, 50.997, 50.458,
50.458, 50.458, 50.458, 49.61, 49.61, 49.61, 49.61, 50.95, 50.95,
50.95, 50.95, 49.273, 49.273, 49.273, 49.273, 46.993, 46.993,
46.993, 46.993, 47.368, 47.368, 47.368, 47.368, 48.526, 48.526,
48.526, 48.526, 51.974, 51.974, 51.974, 51.974, 61.343, 61.343,
61.343, 61.343, 61.38, 61.38, 61.38, 61.38, 61.763, 61.763, 61.763,
61.763, 61.96, 61.96, 61.96, 61.96, 59.295, 59.295, 59.295, 59.295,
59.98, 59.98, 59.98, 59.98, 59.233, 59.233, 59.233, 59.233, 56.633,
56.633, 56.633, 56.633, 57.81, 57.81, 57.81, 57.81, 63.66, 63.66,
63.66, 63.66, 67.34, 67.34, 67.34, 67.34, 67.59, 67.59, 67.59,
67.59, 68.453, 68.453, 68.453, 68.453, 66.291, 66.291, 66.291,
66.291, 62.495, 62.495, 62.495, 62.495, 61.142, 61.142, 61.142,
61.142, 51.96, 51.96, 51.96, 51.96, 48.465, 48.465, 48.465, 48.465,
51.932, 51.932, 51.932, 51.932, 54.498, 54.498, 54.498, 54.498,
56.787, 56.787, 56.787, 56.787, 58.053, 58.053, 58.053, 58.053,
57.649, 57.649, 57.649, 57.649, 54.156, 54.156, 54.156, 54.156,
39.908, 39.908, 39.908, 39.908, 40.138, 40.138, 40.138, 40.138,
41.303, 41.303, 41.303, 41.303, 41.175, 41.175, 41.175, 41.175,
39.023, 39.023, 39.023, 39.023, 39.09, 39.09, 39.09, 39.09, 39.238,
39.238, 39.238, 39.238, 44.308, 44.308, 44.308, 44.308, 41.595,
41.595, 41.595, 41.595, 45.503, 45.503, 45.503, 45.503, 45.773,
45.773, 45.773, 45.773, 46.703, 46.703, 46.703, 46.703, 51.37,
51.37, 51.37, 51.37, 50.908, 50.908, 50.908, 50.908, 46.036,
46.036, 46.036, 46.036, 43.526, 43.526, 43.526, 43.526, 38.05,
38.05, 38.05, 38.05, 34.29, 34.29, 34.29, 34.29, 34.306, 34.306,
34.306, 34.306, 37.668, 37.668, 37.668, 37.668, 41.563, 41.563,
41.563, 41.563, 41.171, 41.171, 41.171, 41.171, 42.225, 42.225,
42.225, 42.225, 43.463, 43.463, 43.463, 43.463)), row.names = c(NA,
672L), class = "data.frame")
I want to calculate the mean absolute percentage error for each (calendar) week of the dataset and I have tried several ways, such as the function apply.weekly, but none of them seems to work.
apply.weekly(df, function(x) mean(abs((df$Actual-df$Forecasted)/df$Actual)))
I keep getting as outcome the same value for each quarter of the dataset, and not an outcome for each week.
Do you have any ideas on how to implement this calculation?
Thank you in advance for your help.
Perhaps like so:
library(lubridate)
library(magrittr)
df %>% group_by( isoweek( DATETIME ), year( DATETIME ) ) %>%
summarise( DateCount = n_distinct(date(DATETIME)), MeanError = mean( abs(Forecasted-Actual)/Actual ) )
It outputs:
`isoweek(DATETIME)` `year(DATETIME)` DateCount MeanError
<dbl> <dbl> <int> <dbl>
1 44 2020 1 0.858
2 45 2020 6 0.357
With the updated data source:
df <- read.delim( "https://raw.githubusercontent.com/Argiro1983/data-set/main/test1", sep=";" ) %>%
as_tibble
df %<>% mutate( DATETIME = dmy_hm(DATETIME) )
df %>% group_by( year( DATETIME ), isoweek( DATETIME ) ) %>%
summarise( DateCount = n_distinct(date(DATETIME)), MeanError = mean( abs(Forecasted-Actual)/Actual ) )
Output:
`year(DATETIME)` `isoweek(DATETIME)` DateCount MeanError
<dbl> <dbl> <int> <dbl>
1 2020 44 1 0.858
2 2020 45 7 0.321
3 2020 46 7 0.505
4 2020 47 7 0.439
5 2020 48 7 0.309
6 2020 49 7 0.545
7 2020 50 7 0.342
8 2020 51 7 0.357
9 2020 52 7 0.204
10 2020 53 4 0.120
# … with 14 more rows
Dates should work fine if you set them up correctly.
I have a data frame that indicates a road type and 24 columns (h_1 ... h_24) that show how many vehicles pass (relatively over the day) per hour. Each row is a different road.
I'm interested to find commonalities among types. My intended output is a condensation of the roadtypes. I.e. road type 2 and 3 appear to have the same pattern, so they are group into a new category (e.g. category).
So my question is, how can one detect this kind of pattern with as many as 15 different types?
Part of my data:
structure(list(type = c(14, 14, 11, 4, 13, 12, 13, 13, 13, 13,
11, 14, 1, 11, 14, 11, 4, 13, 14, 9, 14, 13, 13, 9, 14, 13, 1,
11, 14, 13, 13, 13, 11, 13, 15, 11, 14, 11, 14, 13, 9, 11, 13,
9, 14, 13, 13, 13, 13, 13, 9, 14, 13, 12, 11, 14, 11, 4, 11,
4, 13, 9, 13, 9, 13, 13, 1, 15, 1, 6, 13, 11, 13, 6, 11, 11,
11, 13, 13, 13, 12, 13, 14, 13, 11, 9, 14, 11, 13, 11, 3, 11,
11, 11, 14, 11, 13, 14, 13, 11, 11, 14, 11, 11, 13, 15, 12, 11,
4, 13, 14, 13, 11, 13, 14, 11, 9, 13, 13, 11, 11, 11, 13, 11,
11, 13, 13, 13, 14, 11, 9, 11, 13, 4, 12, 13, 13, 9, 13, 11,
13, 11, 13, 1, 9, 13, 11, 11, 13, 11), h_1 = c(1.091, 0.591,
1.129, 0.274, 0.178, 1.507, 0.654, 1.003, 0.228, 0.657, 1.411,
0.97, 0.875, 0.397, 1.462, 1.063, 0.648, 1.181, 0.629, 1.219,
2.193, 1.054, 0.768, 0.922, 1.525, 2.891, 0.888, 1.171, 0.684,
0.455, 0.562, 1.138, 0.895, 0.71, 0.445, 1.444, 3.644, 2.365,
0.391, 0.687, 1.037, 0.423, 2.14, 0.942, 1.33, 0.737, 1.766,
0.144, 1.08, 0.672, 0.629, 0.39, 0.325, 1.079, 2.099, 0.163,
0.871, 1.112, 1.731, 0.313, 1.039, 1.057, 1.159, 0.959, 0.755,
0.741, 0.429, 1.017, 0.602, 0.359, 0.574, 0.872, 0.639, 0.786,
0.857, 1.212, 2.553, 1.755, 0.543, 1.691, 0.715, 0.352, 1.431,
1.188, 2.115, 0.536, 0.605, 0.894, 0.745, 2.639, 0.545, 1.135,
0.702, 0.82, 0.462, 0.263, 1.362, 0.226, 0.801, 1.783, 1.301,
1.024, 1.394, 1.512, 1.151, 4.175, 0.644, 2.11, 0.518, 1.938,
1.048, 0.942, 1.233, 1.024, 1.967, 1.601, 0.736, 0.496, 1.346,
1.109, 0.78, 0.635, 0.567, 0.378, 2.976, 0.453, 0.392, 1.362,
1.042, 0.555, 1.218, 0.936, 1.098, 0.868, 1.172, 0.247, 1.287,
0.824, 1.025, 0.863, 1.484, 0.507, 1.335, 0.637, 1.986, 1.137,
0.837, 1.787, 0.353, 1.865), h_2 = c(0.607, 0.284, 0.753, 0.164,
0.085, 1.046, 0.422, 0.816, 0.1, 0.445, 1.032, 0.559, 0.699,
0.334, 1.092, 0.544, 0.494, 0.803, 0.251, 0.862, 2.53, 1.389,
0.705, 0.382, 0.932, 2.332, 0.604, 0.801, 0.329, 0.248, 0.411,
0.866, 0.584, 0.295, 0.26, 0.873, 2.943, 1.887, 0.287, 0.462,
0.668, 0.411, 2.101, 0.636, 0.88, 0.389, 1.24, 0.072, 0.804,
0.481, 0.346, 0.194, 0.093, 0.629, 1.644, 0.122, 0.615, 0.604,
1.308, 0.25, 0.577, 0.996, 0.849, 0.594, 0.418, 0.452, 0.252,
0.706, 0.348, 0.16, 0.297, 0.608, 0.57, 0.413, 0.745, 0.839,
1.894, 1.315, 0.344, 1.046, 0.35, 0.206, 0.987, 0.422, 1.595,
0.229, 0.263, 0.501, 0.556, 2.112, 0.303, 0.765, 0.485, 0.517,
0.24, 0.11, 0.88, 0.104, 0.649, 1.198, 0.948, 0.708, 0.917, 0.729,
0.743, 3.336, 0.35, 1.635, 0.253, 1.421, 0.539, 0.554, 0.82,
0.708, 1.411, 1.011, 0.638, 0.297, 0.918, 0.427, 0.676, 0.449,
0.556, 0.401, 2.192, 0.194, 0.264, 0.879, 0.667, 0.319, 0.854,
0.613, 0.683, 0.481, 0.855, 0.305, 0.865, 0.593, 0.568, 0.552,
1.002, 0.314, 0.953, 0.341, 1.415, 0.508, 0.441, 1.18, 0.24,
1.277), h_3 = c(0.505, 0.171, 0.277, 0.164, 0.097, 0.774, 0.305,
0.646, 0.132, 0.416, 0.853, 0.412, 0.621, 0.508, 0.8, 0.336,
0.432, 0.667, 0.163, 0.7, 2.953, 0.383, 0.656, 0.161, 0.635,
0.551, 0.466, 0.295, 0.229, 0.217, 0.141, 1.002, 0.498, 0.138,
0.177, 0.531, 1.688, 1.634, 0.259, 0.472, 0.565, 0.42, 2.051,
0.488, 0.703, 0.202, 1.03, 0.072, 0.603, 0.552, 0.208, 0.122,
0.023, 0.419, 1.278, 0.081, 0.54, 0.397, 0.921, 0.188, 0.357,
1.049, 0.602, 0.431, 0.193, 0.191, 0.204, 0.452, 0.3, 0.1, 0.173,
0.216, 0.531, 0.28, 0.772, 0.307, 1.486, 0.994, 0.164, 0.681,
0.229, 0.222, 0.723, 0.134, 1.217, 0.189, 0.152, 0.205, 0.562,
1.579, 0.242, 0.114, 0.434, 0.401, 0.218, 0.07, 0.645, 0.111,
0.604, 0.876, 0.847, 0.603, 0.797, 0.573, 0.464, 2.183, 0.266,
1.08, 0.161, 1.034, 0.342, 0.43, 0.533, 0.603, 1.064, 0.601,
0.731, 0.24, 0.801, 0.173, 0.192, 0.141, 0.522, 0.435, 1.044,
0.129, 0.226, 0.64, 0.502, 0.113, 0.466, 0.54, 0.523, 0.283,
0.697, 0.321, 0.701, 0.461, 0.358, 0.403, 0.828, 0.151, 0.662,
0.272, 0.997, 0.28, 0.195, 0.611, 0.353, 1.027), h_4 = c(0.366,
0.166, 0.218, 0.206, 0.047, 0.625, 0.333, 0.685, 0.691, 0.739,
0.937, 0.397, 0.739, 0.703, 0.737, 0.304, 0.432, 0.621, 0.163,
0.774, 2.831, 0.101, 0.929, 0.153, 0.466, 0.186, 0.454, 0.218,
0.331, 0.302, 0.105, 2.127, 0.638, 0.188, 0.264, 0.548, 1.327,
1.387, 0.394, 0.791, 0.614, 0.639, 1.671, 0.496, 1.185, 0.179,
1.192, 0.287, 0.779, 0.844, 0.265, 0.187, 0.023, 0.383, 1.169,
0.122, 0.764, 0.334, 0.835, 0.188, 0.367, 1.277, 0.799, 0.414,
0.193, 0.245, 0.3, 0.367, 0.363, 0.2, 0.254, 0.167, 0.574, 0.186,
1.166, 0.221, 1.512, 0.832, 0.161, 0.714, 0.326, 0.416, 0.867,
0.23, 1.107, 0.348, 0.218, 0.179, 0.935, 1.295, 0.262, 0.177,
0.823, 0.472, 0.295, 0.116, 0.717, 0.271, 0.791, 0.958, 1.371,
0.744, 0.968, 0.706, 0.409, 1.466, 0.249, 0.912, 0.207, 0.827,
0.332, 0.359, 0.702, 0.744, 0.859, 0.544, 0.993, 0.357, 1.109,
0.218, 0.299, 0.144, 0.558, 1.027, 0.761, 0.172, 0.349, 0.719,
0.664, 0.18, 0.406, 0.777, 0.541, 0.274, 0.918, 1.109, 0.675,
0.522, 0.321, 0.489, 0.828, 0.085, 0.57, 0.351, 0.823, 0.134,
0.215, 0.559, 0.396, 1.172), h_5 = c(0.759, 0.362, 0.394, 1.041,
0.08, 0.598, 0.714, 0.738, 4.113, 1.674, 0.948, 0.661, 1.051,
2.606, 0.996, 0.462, 0.571, 1.056, 0.415, 1.242, 2.291, 0.096,
1.211, 0.288, 0.593, 0.727, 0.721, 0.305, 0.967, 0.687, 0.257,
4.004, 1.267, 0.381, 0.628, 0.813, 1.521, 1.281, 0.925, 1.738,
0.872, 2.14, 1.936, 0.698, 1.752, 0.29, 2.07, 0.647, 1.381, 1.377,
0.531, 0.514, 0.162, 0.408, 1.346, 0.448, 2.163, 0.429, 0.907,
0.563, 0.499, 2.062, 1.532, 0.572, 0.396, 0.52, 0.754, 0.537,
0.714, 0.819, 0.821, 0.255, 0.836, 0.266, 2.112, 0.313, 2.199,
0.796, 0.367, 1.3, 0.544, 1.199, 1.131, 0.23, 1.134, 1.306, 0.417,
0.199, 1.416, 1.598, 0.545, 0.3, 2.043, 0.963, 0.652, 0.354,
1.26, 0.793, 1.481, 1.838, 3.07, 1.419, 1.634, 0.932, 0.39, 1.545,
0.701, 1.102, 0.46, 0.887, 0.585, 0.543, 0.999, 1.419, 1.107,
0.623, 1.456, 0.56, 1.963, 0.231, 0.439, 0.162, 0.784, 2.901,
1.314, 0.323, 0.847, 1.264, 1.313, 0.417, 0.78, 1.9, 0.857, 0.538,
1.647, 2.558, 1.153, 0.768, 0.568, 0.91, 1.421, 0.237, 0.755,
0.832, 1.183, 0.107, 0.491, 1.175, 0.848, 2.117), h_6 = c(1.836,
0.961, 1.605, 3.069, 0.089, 1.005, 2.508, 1.717, 5.413, 4.381,
1.665, 1.441, 1.89, 6.892, 2.116, 1.612, 1.157, 2.141, 1.571,
3.35, 2.667, 0.718, 1.845, 0.978, 1.186, 1.787, 1.974, 1.03,
2.14, 1.405, 1.073, 5.952, 3.467, 1.101, 1.578, 2.122, 2.36,
1.302, 2.865, 3.508, 1.718, 4.415, 2.705, 1.552, 3.541, 0.97,
3.108, 0.862, 3.365, 2.782, 1.806, 1.757, 2.921, 0.752, 2.146,
0.855, 4.545, 0.683, 1.447, 1.939, 1.292, 3.794, 3.581, 1.262,
1.564, 1.683, 3.417, 0.65, 1.804, 2.016, 2.446, 0.702, 1.869,
0.746, 3.343, 1.033, 3.984, 1.067, 1.434, 2.076, 2.226, 4.295,
2.023, 1.016, 1.737, 3.669, 1.225, 0.485, 2.42, 3.062, 1.736,
1.372, 3.244, 2.885, 1.806, 2.403, 2.771, 1.791, 2.834, 3.889,
4.502, 2.807, 3.486, 2.375, 0.817, 1.847, 2.197, 2.185, 1.645,
1.362, 1.48, 1.149, 1.788, 2.807, 2.003, 0.997, 2.618, 1.616,
3.618, 1.369, 1.354, 0.5, 2.065, 4.543, 2.877, 1.271, 2.494,
2.778, 3.167, 1.745, 2.359, 4.095, 1.943, 1.415, 3.547, 5.202,
2.58, 1.96, 1.124, 3.238, 3.02, 1.367, 1.726, 2.302, 2.512, 0.759,
2.192, 3.15, 2.839, 4), h_7 = c(3.944, 2.971, 3.597, 7.331, 0.157,
3.246, 5.143, 4.038, 4.62, 8.276, 3.273, 4.792, 4.084, 7.116,
5.171, 4.521, 4.489, 3.858, 4.978, 4.881, 5.335, 1.361, 3.734,
2.205, 3.643, 3.594, 3.541, 2.524, 4.838, 4.157, 2.983, 6.644,
7.517, 2.41, 4.247, 5.508, 4.549, 2.551, 6.072, 6.069, 2.842,
5.862, 5.345, 3, 4.769, 2.266, 4.495, 1.15, 6.454, 4.976, 5.955,
6.088, 4.59, 2.782, 4.862, 2.28, 5.885, 2.574, 3.431, 4.878,
5.899, 5.832, 5.674, 3.591, 3.531, 4.825, 7.777, 2.232, 5.971,
6.209, 5.998, 2.159, 4.549, 2.784, 4.631, 2.271, 5.291, 3.231,
3.554, 4.512, 5.732, 8.902, 3.408, 3.22, 3.883, 6.306, 2.911,
1.414, 4.128, 3.826, 5.774, 2.821, 5.404, 5.808, 5.438, 5.799,
4.229, 4.481, 4.958, 5.625, 5.415, 4.743, 5.998, 4.464, 2.284,
3.182, 6.053, 4.695, 6.305, 3.106, 2.605, 2.989, 4.678, 4.743,
4.143, 2.808, 4.523, 4.027, 4.915, 5.688, 2.799, 1.262, 4.947,
5.731, 5.335, 3.685, 5.917, 4.241, 7.878, 3.28, 5.54, 4.96, 5.138,
4.028, 6.175, 7.239, 4.571, 4.087, 3.57, 5.434, 4.19, 3.716,
3.671, 7.065, 4.635, 1.697, 4.962, 4.667, 4.746, 4.848), h_8 = c(5.215,
5.386, 6.699, 8.865, 0.427, 5.445, 7.39, 6.853, 6.185, 7.8, 5.74,
6.424, 6.53, 7.32, 6.008, 8.395, 10.026, 4.249, 8.699, 5.004,
6.313, 2.168, 7.191, 5.241, 5.125, 5.37, 5.069, 4.746, 6.941,
7.316, 6.779, 6.306, 7.13, 4.673, 7.553, 6.066, 5.055, 4.024,
8.355, 6.071, 3.719, 6.783, 7.185, 3.995, 5.642, 4.749, 5.131,
1.833, 6.354, 6.263, 7.299, 8.336, 6.351, 4.624, 5.835, 4.439,
5.088, 4.1, 5.431, 4.44, 7.039, 6.247, 5.87, 5.735, 6.145, 6.091,
7.619, 6.102, 8.134, 6.349, 8.065, 5.498, 6.431, 4.169, 5.304,
4.546, 5.721, 5.607, 7.894, 6.478, 7.121, 7.671, 4.972, 5.923,
4.956, 7.251, 5.109, 4.452, 6.651, 4.112, 6.743, 5.306, 5.581,
6.09, 8.751, 10.775, 4.649, 6.467, 6.948, 5.593, 5.717, 5.431,
6.158, 5.759, 3.807, 3.975, 6.76, 5.866, 7.375, 4.356, 4.117,
4.146, 7.317, 5.431, 6.002, 4.177, 5.432, 6.185, 5.164, 8.952,
4.595, 3.218, 6.032, 5.805, 5.246, 4.59, 8.141, 4.648, 8.084,
6.147, 5.986, 4.995, 6.718, 4.528, 8.55, 8.742, 5.106, 6.335,
4.793, 5.607, 4.527, 9.264, 5.148, 7.653, 5.048, 3.544, 6.039,
5.443, 5.538, 4.979), h_9 = c(5.279, 5.904, 7.211, 6.111, 0.686,
5.486, 6.411, 7.185, 7.688, 5.984, 5.925, 5.703, 6.011, 6.917,
5.155, 6.805, 9.44, 4.454, 7.568, 4.831, 5.196, 1.964, 7.191,
4.502, 4.701, 4.84, 5.185, 4.929, 7.045, 7.729, 6.769, 5.887,
5.477, 5.668, 7.034, 6.077, 4.772, 4.451, 7.419, 6.329, 4.182,
6.222, 6.138, 4.144, 6.23, 4.38, 5.154, 2.3, 6.404, 5.772, 5.932,
7.208, 7.626, 4.986, 5.043, 8.145, 5.184, 4.195, 5.652, 4.941,
5.91, 5.384, 5.672, 6.187, 5.849, 6.842, 5.453, 7.599, 6.645,
4.831, 8.056, 5.92, 6.229, 4.236, 5.425, 4.728, 5.045, 5.764,
9.408, 6.174, 6.258, 6.956, 5.795, 6.728, 4.565, 6.555, 5.895,
4.633, 7.259, 4.601, 5.855, 5.48, 5.246, 5.448, 7.517, 9.931,
4.938, 6.758, 6.838, 4.945, 5.694, 5.569, 5.11, 5.72, 4.327,
4.316, 6.338, 5.586, 6.627, 4.62, 5.437, 5.406, 6.071, 5.569,
4.98, 4.102, 5.439, 7.023, 5.06, 6.871, 5.272, 3.925, 6.269,
5.077, 4.981, 4.224, 6.76, 4.936, 7.325, 6.029, 5.669, 5.122,
6.133, 4.009, 8.74, 8.375, 4.909, 5.907, 4.212, 5.546, 4.625,
9.848, 5.362, 6.648, 4.422, 3.788, 6.14, 5.741, 5.806, 5.027),
h_10 = c(5.058, 6.346, 6.55, 5.07, 1.484, 5.323, 5.278, 5.735,
6.742, 5.904, 5.429, 5.483, 5.835, 6.039, 4.841, 5.971, 6.849,
5.019, 5.946, 5.286, 4.46, 2.251, 5.69, 4.145, 4.659, 4.651,
4.937, 4.407, 6.683, 8.145, 6.157, 5.74, 5.485, 6.393, 7.573,
6.145, 4.81, 4.735, 5.986, 6.048, 4.754, 6.089, 5.299, 4.212,
5.896, 4.195, 5.432, 4.06, 5.801, 4.853, 5.505, 6.439, 8.785,
5.16, 4.865, 5.701, 6.12, 4.608, 5.585, 5.691, 5.775, 5.481,
5.769, 5.989, 5.114, 6.312, 4.829, 5.96, 5.713, 4.073, 6.565,
4.873, 5.742, 5.089, 5.368, 4.296, 4.905, 5.46, 6.302, 6.095,
5.621, 6.09, 5.853, 6.594, 4.785, 5.915, 6.814, 4.733, 7.454,
4.967, 6.562, 5.022, 5.416, 5.736, 6.562, 7.703, 5.361, 7.068,
5.823, 5.008, 5.717, 6.034, 5.176, 5.567, 4.828, 4.853, 5.759,
5.522, 6.224, 5.135, 6.105, 6.028, 5.328, 6.034, 5.202, 4.424,
5.67, 5.98, 5.371, 5.011, 5.106, 4.307, 6.163, 5.434, 5.086,
4.31, 5.25, 5.36, 5.911, 5.119, 5.45, 5.3, 5.851, 4.142,
5.795, 5.223, 5.202, 4.818, 4.274, 5.377, 5.083, 7.644, 5.714,
5.638, 4.582, 4.417, 6.002, 5.24, 6.413, 5.264), h_11 = c(5.189,
7.161, 6.16, 5.029, 3.229, 5.663, 5.523, 6.22, 5.834, 5.981,
5.588, 5.924, 6.1, 5.593, 5.359, 5.823, 5.877, 5.658, 6.034,
5.53, 4.847, 3.975, 5.727, 4.918, 5.083, 5.428, 5.219, 4.19,
6.593, 8.498, 5.693, 5.474, 5.866, 7.03, 7.822, 6.103, 4.899,
5.251, 5.579, 5.878, 5.56, 6.383, 5.226, 4.756, 6.012, 4.302,
5.936, 3.881, 5.65, 4.818, 5.626, 6.501, 4.288, 5.74, 5.171,
6.108, 6.609, 5.514, 5.815, 7.067, 5.748, 5.871, 6.02, 6.103,
5.188, 6.302, 4.994, 6.102, 5.514, 4.232, 4.934, 4.352, 5.851,
6.021, 5.562, 3.678, 5.036, 5.673, 4.629, 6.192, 5.913, 5.603,
5.916, 7.591, 5.181, 5.692, 7.577, 5.298, 7.374, 5.33, 6.885,
5.202, 5.675, 6.281, 6.411, 5.672, 5.839, 7.519, 6.107, 5.004,
6.014, 6.47, 5.543, 5.677, 5.682, 5.023, 6.043, 5.651, 6.42,
5.696, 6.552, 6.117, 5.337, 6.47, 5.716, 5.585, 6.013, 5.962,
5.692, 4.826, 6.334, 6.454, 6.221, 5.687, 5.396, 5.452, 5.035,
5.838, 5.372, 4.676, 5.881, 5.53, 5.994, 5.085, 4.497, 4.996,
5.709, 4.862, 5.015, 5.277, 5.425, 6.354, 6.517, 5.427, 5.353,
5.554, 5.542, 5.476, 7.077, 5.483), h_12 = c(6.006, 7.094,
5.992, 4.892, 5.527, 5.758, 5.853, 6.067, 5.441, 5.388, 5.872,
6.497, 6.347, 5.749, 5.449, 5.799, 5.769, 5.261, 6.084, 5.822,
4.877, 2.203, 6.523, 6.14, 5.972, 5.421, 5.607, 4.782, 6.095,
8.027, 5.084, 5.227, 5.285, 7.219, 8.326, 5.96, 4.82, 5.55,
5.881, 5.624, 6.303, 6.584, 5.299, 5.366, 7.179, 4.949, 5.607,
5.102, 5.977, 5.271, 5.926, 6.274, 5.239, 6.359, 5.375, 6.231,
6.533, 6.817, 5.978, 6.754, 5.845, 6.12, 5.96, 6.148, 5.58,
6.066, 5.093, 6.271, 5.443, 5.151, 5.033, 5.141, 6.123, 6.887,
5.763, 4.457, 4.872, 5.669, 4.608, 6.125, 6.323, 5.127, 6.01,
5.655, 5.62, 6.021, 7.806, 5.97, 6.284, 5.317, 6.945, 5.344,
5.857, 5.594, 6.486, 5.019, 5.764, 7.185, 6.517, 4.913, 5.67,
6.085, 5.197, 5.733, 6.351, 4.874, 5.961, 5.461, 6.546, 6.145,
7.203, 6.776, 5.585, 6.085, 5.576, 6.505, 6.235, 6.488, 5.459,
5.14, 5.987, 6.034, 6.521, 6.028, 5.297, 6.444, 5.302, 5.763,
5.304, 5.01, 6.146, 5.496, 6.166, 5.821, 5.193, 5.692, 5.393,
5.274, 5.633, 5.832, 5.267, 6.054, 6.359, 5.537, 5.942, 5.417,
5.874, 5.397, 6.357, 5.321), h_13 = c(6.382, 7.456, 5.787,
5.111, 8.092, 5.445, 5.874, 6.724, 5.643, 5.912, 5.375, 5.762,
6.451, 5.818, 5.291, 5.136, 5.244, 5.707, 5.607, 6.193, 4.612,
3.928, 6.428, 8.983, 6.057, 6.555, 6.157, 5.853, 6.179, 5.981,
4.841, 5.41, 5.753, 7, 8.053, 5.501, 4.74, 4.947, 6.016,
5.256, 6.574, 6.457, 4.814, 6.047, 7.346, 5.871, 5.659, 7.654,
5.198, 5.101, 5.81, 5.447, 4.822, 6.117, 4.999, 6.068, 6.337,
6.293, 5.421, 6.567, 5.83, 6.171, 5.885, 6.25, 6.075, 6.12,
4.863, 5.763, 5.438, 5.849, 5.203, 6.08, 6.343, 6.008, 6.01,
5.84, 4.99, 5.15, 4.9, 5.82, 5.972, 4.861, 5.949, 4.792,
5.057, 6.005, 7.517, 6.63, 5.745, 5.071, 6.42, 5.11, 5.905,
6.089, 6.229, 4.908, 5.724, 6.269, 6.566, 5.418, 5.983, 6.295,
5.578, 5.634, 6.518, 4.916, 5.878, 5.115, 6.017, 5.491, 6.706,
6.965, 5.24, 6.295, 5.458, 6.077, 6.325, 6.684, 5.684, 5.056,
5.306, 6.174, 6.427, 5.738, 4.824, 6.271, 5.476, 5.723, 4.761,
5.836, 5.52, 5.633, 5.515, 5.849, 4.908, 5.357, 5.863, 5.775,
5.497, 6.402, 5.548, 5.791, 5.729, 5.537, 5.428, 5.091, 6.287,
4.913, 6.385, 5.436), h_14 = c(6.865, 5.34, 5.906, 6.166,
9.527, 6.315, 6.553, 6.379, 6.105, 6.025, 6.292, 6.424, 6.883,
6.203, 5.484, 6.954, 6.694, 6.35, 6.6, 6.346, 4.679, 6.227,
6.058, 6.076, 5.972, 6.76, 6.654, 6.336, 5.184, 5.248, 5.422,
5.054, 5.889, 4.89, 5.566, 6.149, 5.025, 5.514, 7.41, 4.755,
6.912, 6.719, 5.293, 6.723, 6.496, 6.209, 5.786, 8.121, 5.55,
5.609, 6.491, 4.488, 5.447, 6.319, 6.112, 6.516, 6.502, 5.911,
6.069, 6.692, 7.081, 6.498, 5.976, 6.348, 6.311, 6.341, 5.381,
7.006, 5.965, 5.37, 5.652, 6.401, 6.82, 6.394, 6.207, 6.547,
5.016, 6.152, 5.456, 5.946, 6.595, 4.944, 6.151, 6.095, 5.714,
5.279, 5.83, 6.864, 5.711, 5.508, 7.248, 5.787, 6.396, 6.47,
4.872, 5.098, 6.271, 5.829, 6.88, 5.547, 5.769, 6.688, 5.786,
6.033, 6.425, 5.2, 6.2, 5.459, 6.834, 5.91, 5.718, 6.784,
6.603, 6.688, 5.405, 6.225, 6.74, 7.376, 5.74, 6.335, 5.935,
6.486, 6.772, 5.953, 5.135, 8.082, 5.81, 6.27, 5.372, 6.161,
5.642, 6.044, 6.19, 6.189, 5.193, 5.573, 6.394, 6.608, 5.954,
6.519, 5.845, 6.174, 5.795, 6.169, 5.288, 5.769, 6.364, 5.253,
6.865, 5.5), h_15 = c(7.454, 5.195, 5.94, 6.002, 10.864,
6.654, 6.799, 6.13, 5.498, 6.077, 6.352, 6.776, 6.88, 6.709,
5.871, 6.426, 6.077, 6.678, 6.65, 6.6, 4.99, 8.095, 5.381,
5.34, 5.845, 6.582, 7.072, 6.841, 5.417, 6.091, 7.357, 4.885,
6.02, 5.261, 4.931, 6.01, 5.036, 5.988, 8.589, 5.737, 7.698,
6.582, 5.255, 7.67, 5.562, 6.825, 5.761, 11.858, 5.826, 6.003,
6.589, 6.054, 6.282, 6.523, 6.136, 8.43, 6.082, 6.404, 6.26,
7.192, 6.736, 6.455, 6.068, 6.549, 6.964, 6.164, 5.568, 6.864,
6.019, 5.55, 5.904, 6.778, 7.021, 6.847, 6.406, 7.216, 5.114,
6.28, 5.775, 5.734, 6.615, 6.213, 6.276, 7.322, 6.023, 5.611,
5.306, 6.76, 5.528, 5.739, 7.329, 6.309, 7.257, 6.663, 5.473,
5.547, 6.534, 5.841, 6.962, 5.748, 5.743, 6.83, 5.843, 5.92,
6.964, 5.049, 6.489, 5.705, 6.73, 6.203, 5.531, 7.219, 6.125,
6.83, 5.7, 6.524, 7.36, 8.519, 5.953, 5.96, 6.946, 7.938,
6.982, 6.174, 5.345, 7.418, 6.511, 6.533, 5.5, 6.58, 6.061,
6.319, 6.395, 6.557, 5.7, 6.636, 6.572, 7.005, 6.473, 6.506,
6.007, 5.993, 6.241, 6.091, 5.691, 6.779, 6.31, 6.182, 7.12,
5.51), h_16 = c(7.353, 5.787, 6.161, 6.509, 11.262, 6.6,
6.672, 6.25, 5.535, 6.324, 6.301, 6.674, 6.839, 6.908, 6.514,
6.121, 5.723, 7.035, 6.788, 6.444, 5.472, 10.921, 5.469,
6.733, 6.099, 7.474, 7.784, 8.487, 6.129, 6.309, 8.839, 4.975,
6.244, 6.157, 5.251, 5.895, 5.091, 6.433, 7.946, 6.376, 8.058,
6.393, 5.201, 8.733, 5.122, 8.096, 5.822, 14.05, 6.429, 7.071,
6.739, 6.508, 9.411, 6.858, 6.112, 7.9, 5.593, 6.642, 6.337,
9.631, 6.39, 6.58, 6.185, 6.99, 7.174, 6.788, 6.501, 6.554,
6.3, 6.069, 6.71, 8.661, 7.087, 7.406, 6.401, 8.674, 5.231,
6.311, 6.501, 5.362, 6.612, 6.229, 6.31, 7.476, 6.371, 5.721,
5.987, 7.538, 5.516, 5.92, 6.986, 7.295, 7.904, 6.874, 5.512,
5.875, 6.642, 6.295, 7.16, 5.927, 5.687, 6.876, 5.897, 5.846,
6.982, 5.035, 6.525, 6.14, 6.65, 6.413, 5.853, 6.836, 6.103,
6.876, 7.094, 6.733, 7.558, 8.504, 6.279, 5.826, 7.607, 9.105,
6.933, 6.308, 5.709, 8.642, 7.368, 6.641, 5.486, 7.448, 6.471,
6.54, 6.284, 7.538, 5.985, 7.316, 6.634, 7.738, 7.202, 6.59,
6.25, 6.21, 7.009, 6.275, 6.944, 8.511, 6.414, 6.345, 8.462,
5.458), h_17 = c(7.167, 7.165, 5.919, 7.756, 12.506, 7.129,
7.412, 6.438, 5.298, 6.466, 6.854, 7.129, 7.202, 6.979, 6.77,
6.627, 6.324, 7.777, 7.203, 6.508, 5.667, 8.669, 6.065, 9.439,
7.285, 7.226, 8.281, 8.832, 6.582, 6.924, 8.522, 5.317, 6.729,
7.497, 6.009, 5.773, 5.262, 7.128, 7.873, 6.709, 8.085, 6.174,
5.836, 9.419, 4.893, 9.529, 5.867, 11.822, 6.705, 7.529,
8.222, 6.754, 9.434, 7.511, 6.234, 9.366, 5.612, 7.929, 6.565,
11.007, 6.612, 6.502, 5.569, 7.629, 7.499, 6.537, 8.403,
7.203, 7.194, 9.064, 7.337, 9.488, 7.423, 9.125, 6.571, 9.008,
5.25, 6.816, 7.807, 4.967, 7.059, 6.581, 6.776, 6.44, 7.372,
6.307, 7.067, 7.937, 6.697, 6.099, 6.541, 7.105, 7.735, 7.206,
6.397, 6.699, 6.785, 7.179, 6.538, 5.999, 5.715, 7.28, 5.899,
6.314, 7.874, 4.973, 6.749, 6.529, 7.329, 6.864, 6.686, 6.716,
6.861, 7.28, 7.058, 7.46, 7.692, 8.819, 6.566, 6.706, 7.498,
8.927, 7.233, 6.051, 5.679, 9.051, 8.124, 6.784, 6.083, 8.368,
6.798, 6.812, 6.552, 9.764, 6.555, 7.427, 6.784, 8.472, 9.907,
6.597, 6.547, 6.019, 7.633, 6.337, 7.115, 8.625, 6.184, 6.103,
8.772, 5.442), h_18 = c(7.058, 7.77, 5.969, 8.633, 12.037,
7.306, 6.894, 6.405, 5.153, 6.146, 7.364, 7.364, 6.957, 5.973,
7.169, 6.985, 6.725, 7.839, 6.587, 6.543, 5.967, 11.16, 6.889,
9.07, 8.09, 6.462, 7.865, 8.502, 7.144, 7.165, 8.531, 5.366,
6.528, 7.46, 6.469, 5.544, 5.238, 6.939, 6.006, 6.491, 7.755,
6.095, 5.895, 9.065, 4.411, 9.792, 5.774, 9.019, 6.529, 7.222,
7.882, 7.166, 10.153, 7.306, 6.164, 7.33, 5.754, 9.185, 6.489,
7.255, 5.806, 5.824, 6.048, 7.509, 7.557, 6.832, 9.135, 7.684,
7.419, 11.18, 7.139, 9.235, 7.238, 9.511, 6.481, 8.704, 5.364,
6.689, 8.963, 4.646, 6.716, 6.597, 6.789, 7.246, 7.212, 6.937,
7.719, 8.534, 9.163, 6.1, 5.794, 7.592, 7.438, 7.023, 6.806,
7.155, 6.878, 8.076, 6.093, 5.725, 5.875, 7.098, 5.715, 6.532,
8.449, 4.723, 6.721, 6.45, 6.776, 6.859, 7.236, 6.727, 7.348,
7.098, 7.021, 7.778, 6.834, 7.109, 6.399, 7.01, 7.898, 8.565,
6.871, 5.729, 5.585, 7.22, 8.55, 6.877, 6.558, 8.775, 6.949,
6.736, 6.673, 9.698, 7.03, 7.066, 6.649, 7.933, 9.846, 6.694,
6.554, 6.14, 7.51, 6.06, 6.983, 8.531, 5.996, 5.576, 7.289,
5.478), h_19 = c(5.687, 8.075, 5.892, 6.372, 10.094, 6.505,
6.055, 5.797, 4.308, 4.77, 6.675, 6.218, 5.605, 4.336, 6.558,
5.887, 5.707, 6.176, 5.783, 6.067, 5.872, 11.352, 6.618,
7.651, 7.454, 5.176, 6.72, 7.979, 6.034, 5.747, 8.054, 4.695,
4.984, 7.736, 6.157, 5.458, 5.261, 6.257, 3.821, 6.21, 6.625,
4.79, 5.316, 7.361, 4.711, 9.315, 5.403, 5.857, 5.525, 5.933,
6.151, 6.781, 4.937, 7.457, 5.419, 7.371, 5.079, 8.358, 6.193,
4.878, 5.904, 4.811, 6.298, 6.727, 7.392, 6.331, 6.913, 6.525,
6.486, 8.624, 6.014, 7.782, 5.672, 7.646, 5.664, 8.11, 5.042,
6.073, 8.246, 5.056, 5.858, 5.91, 5.882, 6.555, 6.22, 6.095,
7.354, 8.002, 4.622, 6.014, 5.29, 8.174, 5.627, 5.462, 6.43,
6.281, 6.237, 7.622, 4.942, 5.132, 5.341, 5.682, 5.091, 6.343,
8.041, 4.818, 6.213, 5.921, 5.557, 6.2, 7.53, 6.659, 6.437,
5.682, 6.235, 7.109, 5.464, 4.284, 5.601, 6.94, 8.228, 9.3,
5.611, 5.032, 5.403, 7.09, 6.221, 6.236, 5.1, 8.594, 6.678,
6.037, 5.728, 7.849, 5.225, 4.217, 5.536, 6.219, 7.906, 6.242,
5.73, 5.873, 6.65, 5.933, 6.499, 8.912, 6.167, 5.503, 4.775,
5.145), h_20 = c(4.335, 7.319, 5.038, 3.809, 7.279, 5.174,
4.37, 4.575, 4.01, 2.962, 4.964, 4.469, 4.154, 2.597, 5.11,
4.389, 4.196, 4.113, 4.463, 4.879, 4.825, 6.801, 4.192, 6.711,
5.633, 3.724, 4.825, 5.548, 5.191, 3.998, 4.551, 3.612, 3.448,
7.235, 5.353, 4.955, 4.804, 5.121, 2.528, 5.686, 4.958, 3.28,
4.306, 4.993, 4.507, 6.502, 4.176, 4.384, 4.169, 5.125, 4.224,
5.82, 2.643, 5.897, 4.583, 3.95, 4.013, 5.609, 5.064, 3.315,
4.745, 3.624, 4.79, 4.735, 5.903, 5.266, 4.293, 4.887, 4.835,
4.672, 4.213, 4.997, 3.919, 5.129, 4.28, 5.412, 4.299, 4.906,
5.149, 4.539, 4.291, 5.092, 4.387, 4.581, 4.551, 5.163, 6.564,
6.223, 3.045, 5.073, 3.796, 5.932, 3.251, 3.328, 5.627, 4.159,
4.307, 5.604, 3.305, 4.146, 3.588, 3.425, 4.128, 5.207, 5.942,
5.47, 4.795, 4.636, 3.923, 5.068, 7.024, 5.559, 4.797, 3.425,
4.749, 5.418, 3.967, 2.817, 4.05, 4.93, 6.056, 5.937, 3.952,
4.567, 4.945, 4.655, 3.797, 4.306, 3.789, 5.892, 5.141, 4.769,
4.452, 4.943, 3.388, 2.495, 3.919, 4.386, 5.201, 4.942, 4.51,
4.579, 4.658, 5.084, 5.059, 6.827, 5.386, 4.819, 3.15, 4.386
), h_21 = c(3.86, 3.419, 4.111, 2.631, 2.901, 3.924, 3.444,
3.567, 3.663, 2.51, 3.592, 3.19, 3.056, 1.699, 3.313, 3.106,
2.53, 4.047, 2.854, 3.757, 3.214, 5.125, 3.464, 3.532, 4.447,
2.206, 3.573, 4.029, 3.56, 2.206, 3.041, 3.331, 3.154, 3.713,
2.721, 3.886, 3.941, 4.302, 1.914, 3.58, 3.578, 2.488, 3.295,
3.419, 3.464, 4.121, 3.959, 2.623, 3.114, 3.845, 2.729, 3.271,
2.364, 4.42, 3.901, 2.958, 3.419, 3.846, 3.942, 2.502, 3.382,
2.949, 2.888, 3.22, 3.898, 3.666, 2.721, 3.333, 3.232, 3.074,
2.769, 3.477, 2.933, 3.637, 3.498, 3.93, 4.048, 4.086, 2.949,
3.302, 3.14, 2.861, 3.726, 3.719, 3.748, 3.726, 2.921, 4.167,
2.42, 3.438, 2.806, 4.92, 2.626, 3.024, 3.408, 2.507, 3.624,
2.182, 2.355, 4.125, 2.99, 2.472, 4.123, 4.021, 3.955, 4.36,
3.393, 3.194, 2.623, 4.183, 4.177, 4.048, 3.315, 2.472, 3.006,
4.156, 2.923, 2.275, 3.577, 3.417, 4.577, 4.397, 2.805, 3.977,
3.541, 3.47, 2.691, 3.623, 3.066, 3.351, 2.95, 3.814, 3.464,
3.415, 2.565, 1.514, 4.005, 3.375, 3.57, 3.788, 4.596, 2.815,
2.734, 3.424, 3.232, 5.065, 4.094, 4.471, 2.373, 4.404),
h_22 = c(3.696, 2.023, 3.479, 2.055, 2.163, 3.123, 2.472,
2.54, 3.189, 2.453, 2.989, 2.69, 2.246, 1.216, 3.239, 2.623,
1.928, 4.207, 2.124, 2.968, 3.213, 3.784, 2.654, 2.123, 3.304,
2.814, 2.691, 3.423, 2.341, 1.337, 2.192, 3.08, 3.232, 2.579,
1.511, 3.344, 4.409, 4.034, 1.686, 2.237, 2.774, 2.157, 2.773,
2.464, 3.446, 2.751, 3.929, 2.048, 2.612, 3.692, 2.106, 1.589,
2.063, 3.477, 3.512, 2.851, 3.059, 3.226, 3.348, 2.064, 3.048,
2.397, 2.743, 2.451, 2.823, 2.567, 2.173, 2.458, 2.375, 2.476,
2.321, 2.831, 2.438, 2.611, 3.325, 3.481, 4.156, 3.557, 2.092,
4.33, 2.636, 1.537, 3.45, 2.511, 3.678, 2.096, 1.851, 3.461,
2.603, 3.488, 2.362, 3.282, 2.314, 3.142, 1.986, 1.642, 3.632,
1.055, 2.153, 4.491, 2.856, 2.397, 4.122, 3.356, 2.934, 4.786,
2.589, 3.187, 2.048, 4.002, 2.735, 2.987, 2.698, 2.397, 2.828,
3.752, 2.097, 2.043, 3.777, 2.9, 2.703, 2.717, 2.257, 3.32,
3.618, 2.996, 2.167, 3.632, 2.673, 2.361, 2.528, 3.243, 2.883,
2.632, 1.963, 1.051, 4.194, 2.675, 2.631, 2.803, 4.846, 2.025,
2.77, 2.626, 2.987, 3.567, 3.198, 3.879, 1.992, 4.539), h_23 = c(2.771,
1.806, 3.231, 1.822, 0.874, 3.096, 1.884, 2.118, 3.401, 1.712,
2.575, 2.425, 1.7, 0.833, 3.21, 2.331, 1.635, 3.212, 1.81,
2.477, 2.83, 3.832, 2.955, 2.364, 3.092, 3.731, 2.257, 2.996,
2.081, 1.062, 1.65, 2.328, 2.478, 2.521, 1.246, 3.046, 4.689,
3.862, 1.118, 1.894, 2.37, 1.515, 2.688, 2.22, 3.068, 2.166,
3.274, 1.653, 2.135, 2.91, 1.881, 1.311, 1.53, 2.917, 3.262,
1.914, 2.184, 3.067, 2.963, 1.126, 2.437, 1.724, 2.374, 2.059,
2.302, 1.865, 1.824, 2.203, 1.893, 2.236, 2.286, 2.196, 1.89,
2.371, 2.525, 3.207, 3.87, 3.359, 1.699, 4.334, 1.992, 1.304,
3.103, 2.454, 3.464, 1.819, 1.758, 3.134, 2.076, 3.827, 1.898,
3.213, 1.611, 2.344, 1.466, 1.318, 2.943, 0.808, 1.592, 3.638,
2.408, 1.957, 3.311, 2.834, 2.711, 5.069, 1.998, 3.226, 1.703,
3.527, 2.505, 2.487, 2.322, 1.957, 3.006, 3.355, 1.529, 1.497,
2.97, 2.723, 2.029, 2.036, 1.741, 2.5, 4.043, 2.586, 1.534,
2.942, 2.556, 1.832, 2.586, 2.321, 2.488, 2.472, 2.027, 0.891,
3.262, 2.081, 2.582, 2.053, 3.648, 1.831, 2.555, 2.312, 3.148,
2.915, 2.893, 3.55, 0.353, 3.713), h_24 = c(1.516, 1.248,
1.984, 0.918, 0.314, 2.254, 1.036, 1.374, 1.011, 1, 1.993,
1.617, 1.244, 0.555, 2.287, 1.777, 1.033, 1.891, 1.031, 1.717,
2.167, 2.443, 1.655, 1.944, 2.202, 3.513, 1.457, 1.779, 1.281,
0.745, 0.987, 1.579, 1.433, 1.748, 0.825, 2.249, 4.116, 3.06,
0.679, 1.393, 1.779, 0.978, 2.229, 1.602, 1.854, 1.215, 2.428,
0.503, 1.557, 1.299, 1.148, 0.801, 0.487, 1.878, 2.732, 0.652,
1.45, 2.161, 2.309, 0.313, 1.683, 1.293, 1.692, 1.547, 1.174,
1.252, 1.102, 1.525, 1.292, 1.338, 1.234, 1.309, 1.27, 1.452,
1.584, 1.97, 3.122, 2.457, 1.055, 2.882, 1.158, 0.83, 2.086,
1.878, 2.694, 1.223, 1.133, 1.786, 1.089, 3.285, 1.131, 2.242,
1.025, 1.362, 0.956, 0.597, 2.006, 0.465, 1.102, 2.474, 1.779,
1.363, 2.129, 2.214, 1.95, 4.824, 1.127, 2.634, 1.07, 2.754,
1.954, 1.576, 1.76, 1.363, 2.411, 2.436, 1.027, 0.843, 1.989,
2.183, 1.383, 1.187, 1.211, 1.204, 3.67, 1.271, 0.774, 2.006,
1.825, 1.212, 1.921, 1.468, 1.728, 1.623, 1.678, 0.444, 2.039,
1.32, 1.767, 1.336, 2.22, 1.008, 1.943, 1.45, 2.728, 2.065,
1.78, 2.981, 0.24, 2.61)), class = "data.frame", row.names = c(NA,
-150L))
There are different ways of achieving this. In general, you are looking for some unsupervised learning method (have some unlabelled data with characteristics and want to group observations (roads) based on similarity)
First note that in your data, type includes duplicates. That should not be the case, if each row is a different street. I assume this is a mistake:
d$type <- paste0("id_", 1:nrow(d))
dd <- as.matrix(d[,-1])
rownames(dd) <- d$type
K-means clustering:
dd <- scale(dd)
# 4 means clusering
set.seed(123)
km.res <- kmeans(dd, 15, nstart = 25)
# get cluster membership
km.res$cluster[1:10]
id_1 id_2 id_3 id_4 id_5 id_6 id_7 id_8 id_9 id_10
3 10 3 6 2 9 3 3 12 15
Alternatively, hierarchical clustering:
# hierarchical clustering
dist_mat <- dist(dd, method = 'euclidean')
hclust_avg <- hclust(dist_mat, method = 'average')
plot(hclust_avg)
cut_avg <- cutree(hclust_avg, k = 15)
plot(hclust_avg)
rect.hclust(hclust_avg , k = 15, border = 2:6)
abline(h = 3, col = 'red')
# get cluster membership:
cut_avg[1:10]
id_1 id_2 id_3 id_4 id_5 id_6 id_7 id_8 id_9 id_10
1 2 3 3 4 3 3 3 5 3
Note that in general different methods will have different results. If you look into the help files of the functions you will find more information about the possible options for each method, eg for the definition of distance, and for how to compute the clusters (average, max, min, ward).