lower triangular heat-map in r - r

I'm trying to plot a pearson correlation heat map in R on a certain dataset.
The rows and columns of the heat map shall be the same, thus I'm trying to plot a lower triangular plot for it.
The code I'm trying to run is:
cormat_UCS_pearson <- round(cor(t(UCS_pearson)),5)
Where
UCS_perason originally has 58387 columns and two rows, but due to constraints, I'll show
UCS_pearson[,c(1:500)]
structure(c(-0.160788424826038, -0.0257422401750742, -0.0518775542691747,
-0.165841754235558, 0.0621416947620554, 0.222940671263803, 0.0182177186967158,
-0.269665933111091, 0.0108734083848302, -0.0680795555145049,
-0.0314603016241517, 0.100409630242065, 0.491174247937916, 0.153922391186737,
0.0768587331222585, -0.143707163610835, 0.0312164212874025, 0.399184814292453,
-0.153967984972866, 0.204591797534103, -0.0588748849845526, 0.0221869847261395,
-0.12301177706225, 0.0826808454400297, -0.126961149111363, -0.174469497173807,
0.256151155743578, 0.240852646359448, 0.10638094887544, -0.0815900402383247,
0.250473442293516, -0.0238179204071666, -0.144651564807006, -0.280937576894735,
-0.111684092128957, -0.0197076858668464, -0.193220376106192,
-0.0426606909811688, -0.126004286407775, 0.0947536170087334,
0.057738977299137, 0.103571460702936, -0.0157257710015432, 0.149407092075215,
0.127302014752183, -0.206738230688861, -0.060775963589793, -0.189757106698901,
-0.0371024550402435, 0.291246274232428, -0.194659994239295, -0.0689694149696159,
0.160163113758826, 0.17502435406333, -0.341828765694863, 0.0885796257422236,
0.13248737580755, -0.0851616477975954, -0.0225921176857983, -0.00496786994749575,
-0.17139210128259, -0.0754857264355948, -0.326059268523373, -0.197034490794277,
0.187118821445185, -0.3258318107255, -0.0147060076874178, 0.20744856580739,
0.0259449619062298, 0.0133471912808717, -0.089235642663198, -0.104758508695755,
-0.219995628159254, -0.163556018826001, 0.217837787973358, -0.0383668156955706,
0.0446037028532433, 0.0546081091603452, 0.0198990872830052, -0.299886754594252,
0.0690624544291303, -0.151075386942631, -0.0245980828870225,
0.325134214974123, -0.178998579719923, -0.197501542084414, -0.125821792361664,
-0.0831374400037483, -0.0543175598721145, -0.107434351704301,
0.127833423926045, -0.243709143035783, 0.087296540658909, -0.303868722218803,
0.0549884854381427, 0.00283222132557367, -0.360218483376441,
-0.129891049916006, -0.0459448401386707, -0.144868402432394,
-0.0535188683995115, -0.303725269328798, -0.0483750689864511,
-0.207767080382625, 0.0559883421655016, 0.0858848566417679, NA,
NA, NA, NA, -0.116958996376998, 0.217790881211909, 0.0101501061185678,
-0.202050192341405, -0.0881431858631242, -0.194286462214668,
-0.19180463728637, -0.0217840096309176, 0.131094012852616, 0.145435974509276,
0.382016642961684, 0.143664069160626, -0.0703444124193061, 0.270682340825076,
-0.123773734884045, -0.174898297084319, -0.108567975049227, 0.387983258609705,
0.015828181483406, 0.27251194494083, -0.167524773792288, -0.307520405026975,
-0.338574553003239, 0.232510614134642, -0.304841647448181, -0.0877809113428862,
0.0351379398344911, 0.354532976072275, -0.0103688020125061, 0.0670146594763316,
0.431473799708244, 0.213550373925138, -0.254128008083358, 0.238998869027372,
0.245751872540891, -0.201280379473751, 0.266977857736016, -0.0777428082918172,
-0.0686789231261643, 0.190746571654957, 0.255804100930973, 0.188071238929165,
-0.15567163862281, -0.0398148182192045, 0.0462693932429652, -0.00507416965589838,
0.00363537787013793, -0.0188385425590899, 0.0275070608784838,
-0.0534385432423223, -0.235533303097878, 0.000109987362191777,
0.153735230223155, 0.209660579263017, 0.364093077082748, -0.200223246642941,
-0.279468292091011, -0.327788622359998, -0.161785570342061, 0.0221858209145764,
-0.089650270941241, 0.044839622245306, 0.0167494127674376, 0.17763975775981,
-0.211907993676722, 0.476249412131041, -0.127568417870314, 0.111871434618033,
0.0102134076903728, -0.165771097571374, -0.0262893880607643,
-0.24267144356801, 0.0186639441848443, 0.0889160526448091, -0.0275168070171429,
0.105462484914279, -0.104650618921904, 0.485111478944573, -0.0547230640788596,
0.418102872004007, -0.057518923097887, -0.272661215158949, -0.117124831113974,
0.103465628421468, 0.0130711099362795, 0.193421167301985, 0.185748166363864,
0.116518045189166, -0.0535005003380154, 0.146576772396211, -0.0400786368245271,
-0.355485812798769, 0.451651830648632, -0.366605461937997, 0.172424549663343,
-0.140341757305126, 0.0767729688333064, -0.250163351333159, 0.164629010363882,
0.0934583124974739, -0.0257982745866111, 0.143182112676179, -0.0038174243480748,
-0.130737192889484, 0.314900386584229, 0.214116977066315, -0.00490172883881734,
0.308646252172375, -0.373169880595436, 0.360984980326363, -0.00677448042462275,
-0.277436852875204, 0.129349565175812, -0.325470301363098, -0.234973619509544,
-0.164824854977916, -0.0292766889951448, -0.0907647963237643,
-0.319864057611299, 0.0270188473125247, 0.0981459337969273, -0.103491183966377,
0.20984231852361, 0.317321366699691, 0.498494858783593, -0.055812813462925,
0.0811661656281664, -0.280852499373267, -0.171357384217252, -0.0282465534706698,
-0.0387480765018486, -0.129146457915067, -0.470374989360243,
-0.180601632505367, -0.142395528689498, -0.230812618979536, -0.328663331622077,
0.667148931331779, -0.310787006809799, 0.607484764648746, -0.0695639978289592,
0.571428846305687, 0.121589240587617, -0.149946440834327, -0.00049796651995692,
-0.0273667377723118, -0.216744952108681, 0.0720981060950985,
-0.0201231966695146, -0.121282535513109, -0.270602854434521,
0.182350144023858, 0.103005527927574, 0.155195552830089, -0.144345670507073,
-0.168741467053413, 0.148040310295331, 0.196092346617121, NA,
NA, -0.159639365076587, 0.00770350895130156, -0.18495611211399,
0.0666486303528997, -0.0766142699859562, -0.188493474455737,
-0.0435048945218461, -0.223117732044948, -0.0238548540996054,
-0.317445711246788, NA, NA, 0.101286619156465, 0.0950642157902226,
-0.189292595533748, 0.473693004640604, 0.0997608933151469, 0.154916175788068,
-0.0218696636548777, 0.305267207338952, 0.127162496463241, 0.290876940067172,
0.147676819728199, 0.326243074259712, 0.235646247829676, -0.0417812081449229,
0.0429954391404932, -0.291524447226673, -0.0526985369068797,
0.605044141128949, -0.381892266884492, 0.0181871141905498, 0.334334514019781,
0.281403732730617, 0.431864700200925, -0.198503801251651, 0.205059732297505,
-0.131730304224948, -0.060453849529942, -0.0647619911734703,
-0.166359804231634, 0.282486170805339, 0.0100090947328073, -0.37346431271674,
0.421939167218388, -0.504999374742108, -0.0361458397090175, 0.199806590200299,
-0.0923939579395243, 0.300258558209524, 0.307083208123854, -0.372662607142777,
-0.0572583319729891, 0.644732889957074, -0.0904118240718854,
-0.143029858612403, -0.187615998952944, 0.121964949216529, 0.0531386426015056,
0.0624749217328398, 0.206863803305199, -0.262259708980188, 0.0726333418651898,
-0.103658323178436, -0.296071442543119, 0.226374016486998, -0.13440366483565,
0.105501678602159, -0.130030639213654, -0.0110364477837153, NA,
NA, NA, NA, 0.26968371426098, -0.0155890673729734, -0.184284451840467,
-0.0633697628527222, -0.0756406653509469, 0.227411948775754,
NA, NA, -0.125345469385346, -0.0224828981838005, 0.161597493963613,
0.0371197944548526, 0.0148541820967762, -0.189921774311887, -0.397832457796958,
-0.0582032827727681, -0.0764673867131659, -0.0497957441923001,
NA, NA, 0.0449605522472631, 0.0140435671785606, 0.115644287199413,
-0.163612728982696, -0.0369305763029631, 0.152739947872823, -0.181575371181168,
0.154621954754853, NA, NA, -0.314553803719056, 0.344799633261712,
0.0192799528247013, -0.098685769455291, -0.124360554540428, 0.157860234941791,
-0.260396218951657, 0.239485632172963, -0.208741410333448, 0.250827260972775,
-0.142971536264546, 0.207405918032745, NA, NA, NA, NA, -0.0439580344807332,
-0.00181528986796664, -0.0139516499838043, -0.0328095707998725,
-0.0789083514987792, 0.0858281285285902, 0.196262693708447, -0.36649818106507,
0.190538516279416, -0.24916090647245, -0.0728720117481969, -0.0191284575760859,
-0.243389660492848, 0.235641344386585, -0.139766107251914, 0.062247028731737,
-0.246899059846911, 0.178223227792211, -0.190726027555047, -0.0407223282975083,
-0.108655590226593, 0.141082171706391, -0.183351948608341, 0.236140466617194,
0.0336232516784701, 0.159891906857505, -0.244268390987204, 0.229391964824989,
-0.14224137016854, -0.0370043853074932, 0.198093698676019, -0.0745427825448673,
-0.18751615569672, 0.0252952801902908, 0.0148541820967762, -0.189921774311887,
-0.141718980419485, 0.06303858589334, -0.0798637131409112, 0.0206753397045604,
0.0658995925160964, -0.182462081862579, -0.293310524503675, -0.103785090955044,
-0.205789421986016, 0.0737216228863557, -0.18743150613592, 0.0244709344941872,
0.0523090211391174, -0.327774911814208, -0.383791289381148, 0.0224717952896955,
-0.0489466663793394, 0.100849338204541, -0.205632282008697, 0.112731143201648,
NA, NA, -0.0791422176742333, -0.183122879592945, -0.256251541372125,
0.32075114702689, -0.109056115482951, -0.437581856952708, 0.168565776593927,
0.0112315186467975, 0.0205230712251415, -0.152633262615199, NA,
NA, -0.00559346627671493, -0.105939600710423, -0.243200334585682,
-0.0229886745335356, -0.313000186357086, -0.108806585468647,
0.0629844853565044, -0.124978427715945, -0.0998156929088808,
0.28918613444771, -0.229029771129634, 0.17860401699821, 0.192976395550239,
0.0674795315940469, 0.22208076381171, -0.0653077742729489, -0.00441092879437654,
-0.152151871343017, -0.0542585474086585, -0.182156022157871,
0.0243360827586908, -0.159456853362232, -0.315451438915062, 0.00479586764109896,
-0.0658226744519441, -0.054022622684617, -0.14684354898579, -0.0896047917744014,
0.195921804059387, -0.226971922068303, -0.254313406940928, 0.0745354964465048,
0.128381070000955, -0.157056282544603, -0.138751496766607, -0.0562634415442843,
-0.121197670553226, -0.086160697551453, -0.00237992724559371,
-0.115638431740053, NA, NA, -0.0443131642566608, -0.062570457797265,
0.0523959206070392, -0.26451277545694, 0.324554215403563, -0.354636832149615,
0.0900046149894463, -0.21360124829462, 0.328849018719503, -0.563194911556135,
0.0385188334418423, -0.208681554453189, NA, NA, -0.116449694964364,
0.173898476234437, -0.0122353221226405, -0.242859992554905, 0.210779556914438,
-0.136979289161418, 0.112849182471408, -0.0110878937045105, 0.131675159121585,
0.0322369268631404, 0.0722503560841253, -0.105559617713625, 0.145702587734005,
-0.114055843186341, 0.00897168069912057, -0.152779535607564,
0.185416115132091, 0.139648936171848, -0.339435712322975, 0.188493277626503,
-0.219576557100002, 0.0467816679929099, -0.131853773373089, 0.355835047322506,
-0.116170318459756, -0.0062172053864046, -0.00175143214065898,
-0.20938447143972, NA, NA, -0.0645228798411095, -0.053029560023961,
NA, NA, -0.0579625705349727, -0.0879095942957547, -0.0455126985613822,
0.137286630347203, 0.0544159282310674, -0.111029350609663, -0.305157448976381,
0.00287650667329221, -0.0963772261791161, 0.0141550428169644,
-0.118323505439401, 0.0263086012994963, NA, NA, 0.0946996437488379,
-0.0281882901839543, -0.264830491470819, -0.00560255714547876,
NA, NA, 0.0287172038730819, -0.12287491123785, 0.170618969726522,
-0.326371890456747, NA, NA, NA, NA, 0.0074222793941661, -0.178073160886772,
-0.0375507862866806, -0.182780598851118, 0.174405365634955, -0.0244120019683591,
-0.122779951693592, -0.115042812668123, -0.137871428426028, -0.211317089796517,
-0.258126039429376, -0.193566134112804, 0.00147105642397745,
-0.106264366711376, -0.14006867589864, 0.182331899630885, -0.0218154837408014,
0.356667547454766, -0.0412310716225777, 0.00258551517278575,
-0.0339760949801102, -0.0573451484471943, -0.179844910648036,
0.0601934923986177, -0.0954311733961448, -0.257716546080691,
-0.164487954057847, 0.224289601070542, -0.00450016672450693,
0.161798490365034, -0.111255908346463, 0.00906404808218765, 0.00707737733818487,
-0.225878282983652, NA, NA, -0.205008285258871, 0.0543934055830302,
0.012953293999785, -0.199688812112181, -0.105178786172577, 0.0560530628822707,
0.00672275694888985, -0.231344038330046, -0.0807995561538029,
0.0412518012555594, -0.0386808218946201, -0.113881835400778,
0.111253966201852, -0.266822480171457, 0.0600113076474125, 0.126601954785962,
0.185063704213823, 0.166017397633998, NA, NA, 0.0105619900125018,
-0.18651120773984, 0.0763268563546143, -0.166665309941193, -0.178580845628754,
-0.233312517579627, -0.0481684063571434, -0.077797048088731,
-0.203280994156471, -0.142581544437585, 0.0255836118745615, -0.0276336831868125,
-0.0295129513017942, 0.0674858668793503, 0.135260909059116, -0.0927405173056505,
0.0744990456655177, -0.144738862753733, -0.237192573939147, 0.160141253589785,
0.142147193792261, -0.187992976443227, -0.216446688136037, -0.16105196661471,
-0.0508237785151704, 0.118627591076543, -0.182898710862875, 0.0707376228068899,
-0.193890924258218, 0.0900954283356207, 0.00401622925185781,
-0.195921324986153, -0.0694101254841401, 0.0775580321503677,
0.108041719522084, 0.0396115053067626, -0.0458284022403393, -0.218871555395771,
0.121440522444865, -0.0572042815635894, -0.22218652218659, 0.0248185058615541,
0.20938839175807, 0.132481057338594, -0.180258610941658, -0.0284142478612041,
-0.21671672952526, 0.194763389382272, 0.0364715948504319, -0.0657975195408112,
-0.0563040880456959, -0.109544685418116, NA, NA, 0.0648057072675422,
-0.157786229573645, -0.00638799728608172, -0.128516028136478,
0.154035375347516, -0.339760203241564, NA, NA, -0.0864268879423147,
0.0131312434942388, NA, NA, -0.205461907805209, -0.130332837170351,
-0.206680676605858, 0.136703988067015, -0.174060373675473, 0.0659448601839198,
-0.0580533126015975, -0.0314593831638318, -0.0920101781411946,
0.25675637702712, -0.27470347980719, 0.295884532407143, 0.151243691290212,
0.348292828320822, -0.0164280622109516, 0.0294134305588641, -0.355313617294638,
-0.0496116046792636, NA, NA, 0.208051615507144, 0.0612230994890477,
-0.296772891159623, 0.106373198893925, -0.0564000131604138, -0.13755092784139,
-0.0946301230487614, -0.217984541666007, -0.0113011118872734,
-0.353759404722727, NA, NA, -0.125290458742648, 0.0582470395976115,
-0.114798167159317, 0.101545514768859, 0.081099183231184, -0.0827437844416916,
-0.103933326795975, 0.0368614189812161, -0.261860493414426, -0.0839879795872783,
-0.138957366652903, -0.137790816073706, -0.153452701090709, -0.445014708107295,
0.0096604780196279, 0.134783916221383, 0.0452900996550472, -0.210708736380164,
0.0621242385590066, -0.0514563799465529, -0.00744713312770768,
0.0250887647061372, -0.116959036351569, -0.085224863529069, -0.38853419499807,
-0.189952634118266, -0.218665695216765, 0.467745176730558, -0.336315754204112,
0.249063676234904, -0.104035042076053, -0.136859566609601, 0.0525495025377563,
-0.454589141329014, -0.0519257847232248, 0.0205225076770941,
-0.178737694570114, -0.155275617904206, -0.00237992724559371,
-0.115638431740053, -0.110518678178894, -0.108372682262173, -0.287709060609944,
0.0371322942937481, 0.066671589858597, -0.391606873099472, 0.126226324658725,
-0.399388231127899, -0.203849571318033, -0.100361249758939, NA,
NA, -0.187166335014545, -0.124685973058729, -0.191261034341373,
0.125557120478446, NA, NA, -0.172192663023502, 0.0210935670934318,
0.0437454640495771, 0.0649474707755941, -0.0307560655211706,
-0.155943348564083, -0.100459894129437, -0.0837349103788484,
NA, NA, -0.0467230775481449, 0.0445367556198534, -0.0258221029555385,
-0.337769379137755, -0.0949717047071838, -0.0653334039042102,
-0.0916244514588163, 0.208385897193025, -0.0139516499838043,
-0.0328095707998725, 0.108756365899433, -0.205946694745602, 0.0444850847582909,
-0.0456047105712402, -0.123080606885036, 0.166004972978278, -0.0540745862900131,
-0.104383649403864, NA, NA, NA, NA, -0.256514651048856, 0.0389502818708297,
-0.155885002949447, -0.145172040814028, -0.0197648643935328,
-0.154228761470774, -0.245465986869158, 0.196050394893124, -0.0629062361879831,
-0.0418851053863066, -0.0883849505943926, 0.167116542912757,
NA, NA, -0.0945325286387913, -0.244297051453914, 0.0994391613316947,
-0.0414589626231581, -0.0021774093388973, 0.0789953240584772,
-0.28851469166179, 0.212678450880014, 0.178853309299823, 0.0160852171949784,
NA, NA, -0.0724021587657935, -0.0726525233071279, 0.0641256540271004,
-0.247109926514703, 0.261007190593326, 0.162365145316339, 0.183695385237096,
-0.160854132104893, 0.0254757957933874, 0.159302424608104, 0.0536504218846581,
0.0947326442990328, -0.0739825582591165, -0.023444526981956,
NA, NA, -0.246445416033503, 0.0421799991254654, 0.171399843165558,
0.121857838781291, 0.131291806491966, -0.0310256969763662, 0.084932656034447,
0.319694044603215, -0.0889318830147494, 0.244658060764321, -0.0962644796304246,
-0.0406925583175, 0.0719899653174018, 0.186970645556985, -0.269454328187128,
0.115075337197967, NA, NA, 0.124683035292236, 0.0203697993225934,
-0.188138124518597, 0.0454961850788923, -0.0506301523232337,
0.283829223238744, NA, NA, 0.012953293999785, -0.199688812112181,
-0.0414576280113129, 0.195648813114567, -0.178532798762864, 0.0495794181231349,
-0.284278159207787, 0.119933984376387, -0.0736119199628618, -0.0519048539144688,
-0.193631407386575, -0.289684365032212, 0.0521560438562125, -0.122037909970877,
-0.136878270640725, 0.149803202303949, 0.0153790015443654, 0.0202694351487697,
NA, NA, NA, NA, NA, NA, -0.0756117605914394, 0.148175208233554,
-0.271295578246216, 0.409493126095501, -0.01568142586576, -0.0648911279001933,
NA, NA, 0.0671711556674623, 0.0618219987103883, 0.133024970982326,
-0.193030566840229, -0.0158360602199258, -0.0866160392870411,
-0.0675782565096752, -0.0751017710958831, -0.220393224448939,
-0.00966063181064768, -0.0996194859966963, -0.0991640377156096,
0.0726333418651898, -0.103658323178436, -0.27364637703548, 0.273019847922917,
-0.0781696117636672, 0.129417247633593, 0.0297980677565262, -0.134352011645225,
-0.118604292468149, -0.190775713471729, -0.16647638154017, -0.0762085246815682,
-0.0891311686769857, -0.163661512890215, 0.31722215300791, -0.275034100117617,
-0.129169755185721, -0.00241222587250762, -0.107647650941447,
0.127604415704785, -0.166092508902277, -0.195686403184036, 0.0318623953980768,
0.141089701919201, NA, NA, -0.0961135302259641, -0.0798572664410973,
NA, NA, -0.0461883921074545, 0.0834756138899552, -0.08487553609808,
0.00963537949551373, -0.165936066953134, 0.0111744666718458,
-0.0908197261353577, -0.156010494847943, -0.260674035822964,
-0.114751621595064, NA, NA, NA, NA, -0.0136054096164949, -0.0185447185244471,
-0.122981079778463, -0.0111990675185473, -0.182298509501045,
-0.388317916380626, -0.153758412306888, 0.261778719392714, -0.217254978152196,
0.191612183539808, NA, NA, -0.136777432491356, -0.114496580430642,
-0.02969812077836, -0.268652077750056, -0.0508640036811775, -0.000711744011523578,
0.317425038435027, 0.134985042790569, NA, NA), .Dim = c(2L, 500L
), .Dimnames = list(c("tumor_Mes", "tumor_Epi"), c("5_8S_rRNA",
"5S_rRNA", "7SK", "A1BG", "A1BG-AS1", "A1CF", "A2M", "A2M-AS1",
"A2ML1", "A2ML1-AS1", "A2ML1-AS2", "A2MP1", "A3GALT2", "A4GALT",
"A4GNT", "AA06", "AAAS", "AACS", "AACSP1", "AADAC", "AADACL2",
"AADACL2-AS1", "AADACL3", "AADACL4", "AADACP1", "AADAT", "AAED1",
"AAGAB", "AAK1", "AAMDC", "AAMP", "AANAT", "AAR2", "AARD", "AARS",
"AARS2", "AARSD1", "AARSP1", "AASDH", "AASDHPPT", "AASS", "AATBC",
"AATF", "AATK", "AATK-AS1", "AB015752.3", "AB019438.66", "AB019440.50",
"AB019441.29", "ABALON", "ABAT", "ABBA01017803.1", "ABC12-47043100G14.2",
"ABC12-47964100C23.1", "ABC12-49244600F4.4", "ABC14-1080714F14.1",
"ABC7-42391500H16.2", "ABC7-42418200C9.1", "ABC7-43041300I9.1",
"ABC7-481722F1.1", "ABCA1", "ABCA10", "ABCA11P", "ABCA12", "ABCA13",
"ABCA17P", "ABCA2", "ABCA3", "ABCA4", "ABCA5", "ABCA6", "ABCA7",
"ABCA8", "ABCA9", "ABCA9-AS1", "ABCB1", "ABCB10", "ABCB10P1",
"ABCB10P3", "ABCB10P4", "ABCB11", "ABCB4", "ABCB5", "ABCB6",
"ABCB7", "ABCB8", "ABCB9", "ABCC1", "ABCC10", "ABCC11", "ABCC12",
"ABCC13", "ABCC2", "ABCC3", "ABCC4", "ABCC5", "ABCC5-AS1", "ABCC6",
"ABCC6P1", "ABCC6P2", "ABCC8", "ABCC9", "ABCD1", "ABCD1P2", "ABCD1P3",
"ABCD1P4", "ABCD1P5", "ABCD2", "ABCD3", "ABCD4", "ABCE1", "ABCF1",
"ABCF2", "ABCF2P1", "ABCF2P2", "ABCF3", "ABCG1", "ABCG2", "ABCG4",
"ABCG5", "ABCG8", "ABHD1", "ABHD10", "ABHD11", "ABHD11-AS1",
"ABHD12", "ABHD12B", "ABHD13", "ABHD14A", "ABHD14A-ACY1", "ABHD14B",
"ABHD15", "ABHD15-AS1", "ABHD16A", "ABHD16B", "ABHD17A", "ABHD17AP1",
"ABHD17AP3", "ABHD17AP4", "ABHD17AP6", "ABHD17AP9", "ABHD17B",
"ABHD17C", "ABHD2", "ABHD3", "ABHD4", "ABHD5", "ABHD6", "ABHD8",
"ABI1", "ABI2", "ABI3", "ABI3BP", "ABL1", "ABL2", "ABLIM1", "ABLIM2",
"ABLIM3", "ABO", "ABR", "ABRA", "ABRACL", "ABT1", "ABT1P1", "ABTB1",
"ABTB2", "AC000003.1", "AC000029.1", "AC000032.2", "AC000036.4",
"AC000041.10", "AC000041.8", "AC000067.1", "AC000068.10", "AC000068.5",
"AC000068.9", "AC000077.2", "AC000078.5", "AC000081.2", "AC000089.3",
"AC000095.11", "AC000095.9", "AC000099.1", "AC000110.1", "AC000111.3",
"AC000111.4", "AC000111.5", "AC000111.6", "AC000120.7", "AC000123.2",
"AC000123.3", "AC000123.4", "AC000124.1", "AC000354.1", "AC000362.1",
"AC000367.1", "AC000370.2", "AC000374.1", "AC000403.1", "AC000403.4",
"AC001226.7", "AC002044.1", "AC002044.3", "AC002044.4", "AC002056.3",
"AC002056.5", "AC002059.10", "AC002064.4", "AC002064.5", "AC002064.7",
"AC002066.1", "AC002069.5", "AC002069.6", "AC002070.1", "AC002072.1",
"AC002075.3", "AC002075.4", "AC002076.10", "AC002115.5", "AC002115.9",
"AC002116.7", "AC002116.8", "AC002117.1", "AC002127.2", "AC002127.4",
"AC002128.5", "AC002306.1", "AC002310.10", "AC002310.12", "AC002310.13",
"AC002310.14", "AC002310.17", "AC002310.7", "AC002314.4", "AC002331.1",
"AC002365.5", "AC002366.1", "AC002366.3", "AC002368.4", "AC002383.2",
"AC002386.1", "AC002389.1", "AC002395.1", "AC002398.11", "AC002398.12",
"AC002398.13", "AC002398.9", "AC002400.1", "AC002401.1", "AC002407.1",
"AC002429.1", "AC002429.4", "AC002429.5", "AC002451.3", "AC002454.1",
"AC002456.2", "AC002463.3", "AC002464.1", "AC002465.2", "AC002467.7",
"AC002472.11", "AC002480.2", "AC002480.3", "AC002480.4", "AC002480.5",
"AC002486.2", "AC002486.3", "AC002511.2", "AC002511.3", "AC002519.6",
"AC002519.8", "AC002523.1", "AC002530.1", "AC002539.1", "AC002539.2",
"AC002542.2", "AC002543.2", "AC002550.5", "AC002550.6", "AC002551.1",
"AC002553.4", "AC002558.1", "AC002978.1", "AC002979.1", "AC002981.1",
"AC002984.2", "AC002985.3", "AC003001.1", "AC003002.4", "AC003002.6",
"AC003003.5", "AC003005.2", "AC003005.4", "AC003006.1", "AC003006.7",
"AC003009.1", "AC003045.1", "AC003075.4", "AC003080.4", "AC003084.2",
"AC003088.1", "AC003090.1", "AC003092.1", "AC003092.2", "AC003101.1",
"AC003104.1", "AC003658.1", "AC003664.1", "AC003666.1", "AC003681.1",
"AC003682.16", "AC003682.17", "AC003688.1", "AC003956.1", "AC003958.2",
"AC003958.6", "AC003968.1", "AC003973.1", "AC003973.3", "AC003973.4",
"AC003973.5", "AC003984.1", "AC003985.1", "AC003986.5", "AC003986.6",
"AC003986.7", "AC003988.1", "AC003989.3", "AC003989.4", "AC003991.3",
"AC004000.1", "AC004000.2", "AC004004.2", "AC004006.2", "AC004009.1",
"AC004009.2", "AC004009.3", "AC004012.1", "AC004014.3", "AC004014.4",
"AC004016.1", "AC004019.10", "AC004019.13", "AC004022.7", "AC004022.8",
"AC004041.2", "AC004051.2", "AC004052.1", "AC004053.1", "AC004053.2",
"AC004054.1", "AC004057.1", "AC004062.2", "AC004063.1", "AC004066.2",
"AC004066.3", "AC004067.5", "AC004069.1", "AC004069.2", "AC004070.1",
"AC004074.4", "AC004076.5", "AC004076.7", "AC004076.9", "AC004079.1",
"AC004108.1", "AC004112.4", "AC004112.5", "AC004112.7", "AC004125.3",
"AC004129.7", "AC004129.9", "AC004156.3", "AC004158.1", "AC004158.3",
"AC004159.1", "AC004160.4", "AC004166.6", "AC004221.2", "AC004231.2",
"AC004237.1", "AC004257.1", "AC004381.6", "AC004381.7", "AC004383.3",
"AC004386.3", "AC004386.4", "AC004447.2", "AC004448.2", "AC004448.5",
"AC004449.6", "AC004453.1", "AC004453.8", "AC004458.1", "AC004460.1",
"AC004461.4", "AC004470.1", "AC004471.10", "AC004471.9", "AC004477.1",
"AC004485.3", "AC004490.1", "AC004492.1", "AC004510.3", "AC004520.1",
"AC004535.2", "AC004538.3", "AC004540.4", "AC004540.5", "AC004541.1",
"AC004543.1", "AC004543.2", "AC004549.6", "AC004552.1", "AC004593.3",
"AC004595.1", "AC004603.4", "AC004623.2", "AC004623.3", "AC004637.1",
"AC004655.1", "AC004656.1", "AC004673.1", "AC004687.1", "AC004691.1",
"AC004691.5", "AC004692.4", "AC004692.5", "AC004699.1", "AC004702.2",
"AC004744.3", "AC004745.1", "AC004754.3", "AC004769.1", "AC004775.5",
"AC004791.2", "AC004812.1", "AC004813.1", "AC004816.1", "AC004819.1",
"AC004824.1", "AC004824.2", "AC004832.1", "AC004837.1", "AC004837.3",
"AC004837.4", "AC004837.5", "AC004840.8", "AC004846.1", "AC004850.1",
"AC004854.4", "AC004854.5", "AC004862.6", "AC004866.1", "AC004866.3",
"AC004869.2", "AC004869.3", "AC004870.3", "AC004870.4", "AC004870.5",
"AC004875.1", "AC004878.2", "AC004878.8", "AC004893.10", "AC004893.11",
"AC004895.1", "AC004895.4", "AC004899.3", "AC004901.1", "AC004906.3",
"AC004911.2", "AC004915.1", "AC004920.2", "AC004920.3", "AC004924.1",
"AC004932.1", "AC004938.5", "AC004941.3", "AC004941.5", "AC004943.1",
"AC004945.1", "AC004946.1", "AC004947.2", "AC004951.5", "AC004951.6",
"AC004953.1", "AC004967.7", "AC004969.1", "AC004980.1", "AC004980.10",
"AC004980.11", "AC004980.7", "AC004980.8", "AC004980.9", "AC004984.1",
"AC004985.12", "AC004987.10", "AC004987.9", "AC004988.1", "AC005000.1"
)))
This gives me
cormat_UCS_pearson as
structure(c(1, NA, NA, 1), .Dim = c(2L, 2L), .Dimnames = list(
c("tumor_Mes", "tumor_Epi"), c("tumor_Mes", "tumor_Epi")))
Since the values are either 1 or NAs, I cannot move ahead to plot a graph for the same.
Any suggestion to help circumvent this shall be helpful.

The initial steps of my codes produced certain NAs and I had to rectify them in order to get the correct plot.

Related

Find the average of rows with duplicated column value

If the GeneSymbol is duplicated (i.e., there are previous rows containing the string in the GeneSymbol column, calculate the average of the other columns of that row. Then, I want to assign the meth.kirp.cpg$GeneSymbol column as the new row names of meth.kirp.symbol.
meth.kirp.symbol <- aggregate(meth.kirp.cpg, by=meth.kirp.cpg$GeneSymbol,data=meth.kirp.cpg,FUN=mean)
meth.kirp.symbol <- na.omit(meth.kirp.symbol)
Traceback:
Error in !meth.kirp.cpg$GeneSymbol : invalid argument type
rownames(meth.kirp.symbol) <- meth.kirp.symbol$GeneSymbol
meth.kirp.symbol$GeneSymbol <- NULL
Sample data:
> dput(meth.kirp.cpg[1:100,200:203])
structure(list(TCGA.Y8.A8RZ.01A = c(0.497271965133314, 0.369704160054987,
0.891551980644717, 0.53916519146516, 0.452596179682145, 0.763243369017172,
0.158949338942062, 0.0114350980370701, 0.857172998292539, 0.934966165863031,
0.0472399882616577, 0.0198027126658891, 0.0537032844435588, 0.564211104629996,
0.927550968549496, 0.797624950816491, 0.0290697007131178, 0.595912681963104,
0.174701858916678, 0.882333378501306, 0.857440598542643, 0.937145001009176,
0.159643935623585, 0.0516599385847632, 0.0440610541422886, 0.986742471430344,
0.0164534273018356, 0.905466185196924, 0.831233179669209, 0.945308723924202,
0.889966942114764, 0.354918054240825, 0.013300356676493, 0.830128502759263,
0.823700653779667, 0.10271041258008, 0.0287034526533831, 0.0206566535596095,
0.600278705481019, 0.875119985046439, 0.0371692028405492, 0.0222508063515825,
0.93666315025643, 0.928345505993255, 0.901317044941454, 0.765949109446722,
0.0581920996836425, 0.0430643414149486, 0.90591121556885, 0.951186809441601,
0.980658657952396, 0.0808689550165884, 0.572734025228151, 0.0463712698649506,
0.192938671458161, 0.905133179842298, 0.154186184934303, 0.585848485208317,
0.898651062830721, 0.936272438882973, 0.448635246131194, 0.283554776533025,
0.0309419633482652, 0.861391852247259, 0.0658397100529213, 0.0675173265786392,
0.96281794820265, 0.0313479382790672, 0.0866228017859603, 0.929772217122431,
0.200029728957143, 0.706267849864433, 0.94823325183122, 0.0543243613691732,
0.809705102714619, 0.910219965210065, 0.953735039953166, 0.868080342290672,
0.332725938100749, 0.84324363592612, 0.198505346878334, 0.992801413007608,
0.0503582852070818, 0.475444599242399, 0.988297216865074, 0.926321491575251,
0.0243299898333789, 0.10772567979535, 0.892537448190976, 0.98896599725299,
0.305816605549349, 0.696841353119351, 0.807770532814146, 0.115817690804427,
0.0130874570078787, 0.837153421174282, 0.917049247300387, 0.0122380520755151,
0.912364270697772, 0.951585664581661), TCGA.Y8.A8S0.01A = c(0.264547845506278,
0.155993443463906, 0.90708922263186, 0.756216481105085, 0.740439258566013,
0.791640201668772, 0.455406433078148, 0.0140503539973426, 0.898152971615672,
0.942017289363471, 0.049036339456109, 0.0165762503059443, 0.0593335909473265,
0.459771444740498, 0.929336066827294, 0.948532354182067, 0.0181370789479238,
0.309340792232534, 0.444549689057808, 0.968706245954783, 0.911532818633905,
0.922085999840623, 0.439367515136192, 0.0341088658899809, 0.259555790896829,
0.987081295221313, 0.013467632667194, 0.935890204938304, 0.749182228512838,
0.955266815776283, 0.854718619922343, 0.192270767250957, 0.0103294109383117,
0.814778997430484, 0.884929086289906, 0.364141121626961, 0.0261130123662795,
0.0201970054665062, 0.613121306641491, 0.867830249077504, 0.0313157213491265,
0.0247935393251212, 0.911488850004792, 0.895214160236747, 0.52514961950261,
0.88376413256428, 0.0384672039105036, 0.0294663841757698, 0.957910054231064,
0.955637967662581, 0.980805007180895, 0.056939960969146, 0.737932777954196,
0.0318060005100734, 0.0397987294622703, 0.914995576026559, 0.238482151213353,
0.767237616032529, 0.939069872404913, 0.938081858296652, 0.440484138576205,
0.114954872159159, 0.0244136454763111, 0.846540100826359, 0.200658220716674,
0.0687237453669147, 0.974841732977847, 0.0278561439566069, 0.114556259287869,
0.944131549328849, 0.493585389693977, 0.480768780057962, 0.932741163713172,
0.216131694873378, 0.814313163672161, 0.928672085649515, 0.962443725743837,
0.74077045094838, 0.133424847325993, 0.862916554456606, 0.145580720195214,
0.992046334661351, 0.0436393256442202, 0.712662114242391, 0.990103320899525,
0.880978917772909, 0.0225238271112234, 0.116230435240584, 0.841150918912896,
0.987985943353706, 0.127354758970553, 0.898121601977617, 0.906792865660564,
0.0737140541126039, 0.009384930132621, 0.793174978739833, 0.912006490158477,
0.0139855016500958, 0.899386699555785, 0.954405724569427), TCGA.Y8.A8S1.01A = c(0.581694254362101,
0.18542567310602, 0.867542022665212, 0.581696896530406, 0.78744743737146,
0.389767299224826, 0.216960001070295, 0.0124187105565375, 0.856565918074359,
0.936457155497046, 0.0442067173962602, 0.0140296565558842, 0.249846574394466,
0.476357170192695, 0.919768286971888, 0.947576649507426, 0.0180436058702339,
0.832021246626068, 0.417883168882454, 0.97668892894152, 0.858942374669228,
0.908701674774902, 0.360605175695457, 0.0300050878088438, 0.0152722989237764,
0.986911029436886, 0.017968868244694, 0.916403999667678, 0.665473802275997,
0.894770076029211, 0.815937481683747, 0.505075619070648, 0.0100265844940471,
0.807220745685876, 0.808764855317654, 0.316721084000246, 0.0221128261277136,
0.0159144104679436, 0.841207551595894, 0.832097056965122, 0.0307025272327261,
0.0185995888430839, 0.916475132262134, 0.866934314703349, 0.877454940064029,
0.833363153320509, 0.0381805807655402, 0.0273586863112515, 0.941134508841013,
0.912364696768614, 0.979496335094356, 0.0978730283287029, 0.525086161575951,
0.0261062766734918, 0.0320956400558761, 0.853299258800261, 0.131541990462738,
0.52940082480104, 0.85502275403225, 0.894518042164208, 0.535297530625847,
0.4749856970718, 0.0169015303648868, 0.853076664003846, 0.147470852267928,
0.0467328218099492, 0.978302229003696, 0.0283296096497759, 0.0728218303634117,
0.87648102880048, 0.334033090095117, 0.680802308868236, 0.927680442837916,
0.0707104696817582, 0.770195537274174, 0.868009087459515, 0.951475963819618,
0.797689168093036, 0.683015763740223, 0.803432908458056, 0.191347383851541,
0.991395963746777, 0.0604147893723364, 0.874483310648752, 0.98062171660084,
0.83805259736689, 0.0247465538486677, 0.170932965706481, 0.842567160630419,
0.983614792589478, 0.800795162965799, 0.860170927275085, 0.890545098059859,
0.298079674760789, 0.0084611909392357, 0.73227051610062, 0.831245875309251,
0.0115215601617515, 0.784943936721062, 0.835800768909104), GeneSymbol = c("RBL2",
NA, "VDAC3", "ACTN1", "ATP2A1", "SFRP1", NA, "NIPA2", "MAN1B1",
"LRRC16A", "CNBP", "DDX55", "FAM81A", "KCNQ1", NA, "NPHP4", "MRPS25",
NA, NA, "MAEL", "PROX1", "ELOVL1", "LILRA6", "LOC283050", "NR5A2",
"CDK10", NA, "TMEM182", NA, "DNAJA2", "ATOH7", "LRFN1", "MRPL12",
"COL6A3", NA, "C8orf31", "RTTN", "CD2BP2", "SLMAP", NA, "NOV",
"MXD4", "SND1", "MUSTN1", "TAS1R3", "ITGAD", "SMARCC2", "C1orf114",
NA, "C1orf65", "DNAH17", "DAB1", NA, "SLBP", "CHCHD4", NA, "TNNT2",
"CASZ1", "CASZ1", "C3orf16", NA, "WFIKKN2", "CCDC45", NA, "MEOX2",
"CKLF", "TRANK1", "ZFP36", "SLC2A9", "MXRA7", "LOXL4", NA, "P2RX6P",
"SFRS7", NA, "EHMT1", "AGPAT3", "CDSN", NA, NA, "AGA", "LDHD",
"C14orf181", "LOC729176", "SH2B3", "MTMR7", "MT1F", "RSPO3",
"ANKRD11", "TDRD6", "WWP2", "OR1F2P", "SERPINB12", "DOK7", "SRCAP",
"AMDHD2", "DRG2", "TCTE3", "EFNB1", "FAM180B")), row.names = c("cg00000029",
"cg00000165", "cg00000236", "cg00000289", "cg00000292", "cg00000321",
"cg00000363", "cg00000622", "cg00000658", "cg00000721", "cg00000734",
"cg00000769", "cg00000905", "cg00000924", "cg00000948", "cg00000957",
"cg00001245", "cg00001249", "cg00001261", "cg00001349", "cg00001364",
"cg00001446", "cg00001510", "cg00001582", "cg00001583", "cg00001687",
"cg00001747", "cg00001791", "cg00001809", "cg00001854", "cg00001874",
"cg00002033", "cg00002116", "cg00002145", "cg00002190", "cg00002224",
"cg00002236", "cg00002406", "cg00002426", "cg00002449", "cg00002464",
"cg00002490", "cg00002531", "cg00002591", "cg00002593", "cg00002597",
"cg00002660", "cg00002719", "cg00002769", "cg00002808", "cg00002809",
"cg00002810", "cg00002837", "cg00003091", "cg00003173", "cg00003181",
"cg00003287", "cg00003345", "cg00003513", "cg00003529", "cg00003578",
"cg00003625", "cg00003784", "cg00003969", "cg00003994", "cg00004055",
"cg00004067", "cg00004072", "cg00004082", "cg00004089", "cg00004105",
"cg00004121", "cg00004192", "cg00004207", "cg00004209", "cg00004429",
"cg00004533", "cg00004562", "cg00004608", "cg00004773", "cg00004818",
"cg00004883", "cg00004939", "cg00004963", "cg00004979", "cg00004996",
"cg00005010", "cg00005040", "cg00005072", "cg00005083", "cg00005112",
"cg00005166", "cg00005215", "cg00005297", "cg00005306", "cg00005390",
"cg00005437", "cg00005543", "cg00005617", "cg00005619"), class = "data.frame")
As you have some NA's in GeneSymbol, you cannot use them as rownames unless you remove the NA's also.
This code identifies and calculates the mean of the duplicated and NA's rows,
then remove them from the data.frame and assign GeneSymbol as rownames
meth.kirp.duplicated.na <- data.frame(
mean = apply(subset(meth.kirp.cpg,
duplicated(GeneSymbol) | is.na(GeneSymbol),
select = -GeneSymbol), MARGIN = 1, mean),
is.na = with(meth.kirp.cpg, is.na(GeneSymbol)[
duplicated(GeneSymbol) | is.na(GeneSymbol)]))
meth.kirp.cpg <- subset(meth.kirp.cpg, !duplicated(GeneSymbol) & !is.na(GeneSymbol))
rownames(meth.kirp.cpg) <- meth.kirp.cpg$GeneSymbol
If I understand you correctly, you can loop over the rows and calculate an average only when GeneSymbol is a duplicate.
# create empty column for averages
meth.kirp.cpg$average = rep(NA, nrow(meth.kirp.cpg))
# fill column with row average for cases when `GeneSymbol` is a duplicate
for (r in 1:nrow(meth.kirp.cpg)) {
if (sum(na.omit(meth.kirp.cpg$GeneSymbol[r] == meth.kirp.cpg$GeneSymbol)) > 1){
meth.kirp.cpg$average[r] = mean(meth.kirp.cpg[r,1],
meth.kirp.cpg[r,2],
meth.kirp.cpg[r,3])
}
}

Is it possible to extend a line with plotly in R?

Yesterday I asked this question about drawing a line that connects two given points using add_lines() from plotly. That makes me think about some other visualization aspects I want to give to my graph: to connect two given points and extend the line across the whole x-axis.
This is my current database:
dput(sma)
structure(list(time = structure(c(1640808000, 1640822400, 1640836800,
1640851200, 1640865600, 1640880000, 1640894400, 1640908800, 1640923200,
1640937600, 1640952000, 1640966400, 1640980800, 1640995200, 1641009600,
1641024000, 1641038400, 1641052800, 1641067200, 1641081600, 1641096000,
1641110400, 1641124800, 1641139200, 1641153600, 1641168000, 1641182400,
1641196800, 1641211200, 1641225600, 1641240000, 1641254400, 1641268800,
1641283200, 1641297600, 1641312000, 1641326400, 1641340800, 1641355200,
1641369600, 1641384000, 1641398400, 1641412800, 1641427200, 1641441600,
1641456000, 1641470400, 1641484800, 1641499200, 1641513600, 1641528000,
1641542400, 1641556800, 1641571200, 1641585600, 1641600000, 1641614400,
1641628800, 1641643200, 1641657600, 1641672000, 1641686400, 1641700800,
1641715200, 1641729600, 1641744000, 1641758400, 1641772800, 1641787200,
1641801600, 1641816000, 1641830400, 1641844800, 1641859200, 1641873600,
1641888000, 1641902400, 1641916800, 1641931200, 1641945600, 1641960000,
1641974400, 1641988800, 1642003200, 1642017600, 1642032000, 1642046400,
1642060800, 1642075200, 1642089600, 1642104000, 1642118400, 1642132800,
1642147200, 1642161600, 1642176000, 1642190400, 1642204800, 1642219200,
1642233600, 1642248000, 1642262400, 1642276800, 1642291200, 1642305600,
1642320000, 1642334400, 1642348800, 1642363200, 1642377600, 1642392000,
1642406400, 1642420800, 1642435200, 1642449600, 1642464000, 1642478400,
1642492800, 1642507200, 1642521600, 1642536000, 1642550400, 1642564800,
1642579200, 1642593600, 1642608000, 1642622400, 1642636800, 1642651200,
1642665600, 1642680000, 1642694400, 1642708800, 1642723200, 1642737600,
1642752000, 1642766400, 1642780800, 1642795200, 1642809600, 1642824000,
1642838400, 1642852800, 1642867200, 1642881600, 1642896000, 1642910400,
1642924800, 1642939200, 1642953600, 1642968000, 1642982400, 1642996800,
1643011200, 1643025600, 1643040000, 1643054400, 1643068800, 1643083200,
1643097600, 1643112000, 1643126400, 1643140800, 1643155200, 1643169600,
1643184000, 1643198400, 1643212800, 1643227200, 1643241600, 1643256000,
1643270400, 1643284800, 1643299200, 1643313600, 1643328000, 1643342400,
1643356800, 1643371200, 1643385600, 1643400000, 1643414400, 1643428800,
1643443200, 1643457600, 1643472000, 1643486400, 1643500800, 1643515200,
1643529600, 1643544000, 1643558400, 1643572800, 1643587200, 1643601600,
1643616000, 1643630400, 1643644800, 1643659200, 1643673600, 1643688000,
1643702400, 1643716800, 1643731200, 1643745600, 1643760000, 1643774400,
1643788800, 1643803200, 1643817600, 1643832000, 1643846400, 1643860800,
1643875200, 1643889600, 1643904000, 1643918400, 1643932800, 1643947200,
1643961600, 1643976000, 1643990400, 1644004800, 1644019200, 1644033600
), class = c("POSIXct", "POSIXt"), tzone = ""), open = c(0.12428,
0.12167, 0.11791, 0.12133, 0.124, 0.12245, 0.12375, 0.12392,
0.12379, 0.12166, 0.1239, 0.12416, 0.11915, 0.12107, 0.12243,
0.12321, 0.12216, 0.12488, 0.12839, 0.12815, 0.12759, 0.12704,
0.12746, 0.12669, 0.12634, 0.12571, 0.12455, 0.12455, 0.12861,
0.12556, 0.12244, 0.12281, 0.12175, 0.12213, 0.12338, 0.12431,
0.12216, 0.1217, 0.12407, 0.12479, 0.12338, 0.12365, 0.11492,
0.11013, 0.10664, 0.10831, 0.10642, 0.10901, 0.10986, 0.10979,
0.10398, 0.1033, 0.104, 0.10127, 0.10275, 0.10207, 0.10357, 0.10443,
0.10514, 0.10271, 0.09677, 0.10175, 0.10111, 0.10103, 0.10221,
0.10152, 0.10517, 0.10355, 0.10461, 0.10576, 0.10419, 0.09702,
0.09658, 0.09847, 0.10165, 0.10064, 0.0999, 0.10119, 0.10199,
0.10152, 0.10233, 0.10215, 0.10273, 0.1059, 0.10571, 0.10564,
0.10405, 0.10608, 0.10475, 0.10286, 0.10122, 0.10018, 0.10022,
0.10127, 0.09859, 0.10011, 0.10054, 0.10066, 0.10147, 0.10333,
0.10762, 0.11317, 0.11409, 0.11525, 0.11243, 0.11022, 0.10932,
0.11007, 0.10968, 0.11175, 0.11387, 0.11404, 0.11295, 0.10842,
0.10746, 0.10779, 0.11022, 0.11553, 0.11481, 0.11341, 0.1146,
0.11565, 0.11529, 0.11192, 0.11229, 0.11194, 0.11081, 0.10661,
0.10554, 0.10666, 0.10636, 0.10864, 0.10741, 0.09956, 0.09362,
0.09521, 0.09495, 0.0936, 0.09223, 0.08409, 0.0828, 0.07273,
0.07066, 0.07008, 0.0701, 0.072, 0.0711, 0.07424, 0.07467, 0.07324,
0.07124, 0.07559, 0.07096, 0.06866, 0.06469, 0.06602, 0.06853,
0.07014, 0.06903, 0.06895, 0.07152, 0.0715, 0.07204, 0.07213,
0.07263, 0.07346, 0.07471, 0.07629, 0.0757, 0.07368, 0.07013,
0.07135, 0.07329, 0.07601, 0.07396, 0.07423, 0.07524, 0.074,
0.0731, 0.0754, 0.07527, 0.07648, 0.07666, 0.07782, 0.07804,
0.07598, 0.07785, 0.07924, 0.07924, 0.0803, 0.07938, 0.07773,
0.07475, 0.07529, 0.07172, 0.07102, 0.07118, 0.07292, 0.07386,
0.07367, 0.07504, 0.07506, 0.07524, 0.0764, 0.07571, 0.07642,
0.07676, 0.07632, 0.0777, 0.07355, 0.07462, 0.07218, 0.07176,
0.07262, 0.07203, 0.07313, 0.0723, 0.07433, 0.075, 0.07626, 0.07713,
0.07766, 0.07823, 0.07916, 0.08149), high = c(0.1249, 0.1219,
0.1221, 0.12449, 0.12468, 0.12469, 0.125, 0.12459, 0.12419, 0.12509,
0.1247, 0.12435, 0.12219, 0.12314, 0.12337, 0.12379, 0.1257,
0.13202, 0.12864, 0.12884, 0.12778, 0.12824, 0.1275, 0.12846,
0.12643, 0.12586, 0.12611, 0.1293, 0.1291, 0.12598, 0.12539,
0.12323, 0.12241, 0.1235, 0.1258, 0.12597, 0.1243, 0.12522, 0.12494,
0.12527, 0.1252, 0.12372, 0.11609, 0.11294, 0.10881, 0.10838,
0.11043, 0.11073, 0.1107, 0.11156, 0.1046, 0.10593, 0.10532,
0.10439, 0.10434, 0.10447, 0.10498, 0.10556, 0.10518, 0.1035,
0.10294, 0.10226, 0.10237, 0.10302, 0.10435, 0.10577, 0.10697,
0.10637, 0.10794, 0.10592, 0.10451, 0.10002, 0.09904, 0.10209,
0.10208, 0.10162, 0.10222, 0.10529, 0.10228, 0.10552, 0.10301,
0.10383, 0.10751, 0.10666, 0.10712, 0.10641, 0.10727, 0.10798,
0.10733, 0.10371, 0.10179, 0.10146, 0.10257, 0.10128, 0.10085,
0.10155, 0.10168, 0.10219, 0.1042, 0.1084, 0.11577, 0.115, 0.11817,
0.116, 0.1129, 0.11084, 0.11083, 0.1113, 0.11353, 0.11784, 0.11776,
0.11845, 0.11295, 0.10911, 0.10845, 0.11478, 0.11579, 0.1175,
0.11665, 0.11785, 0.11698, 0.1194, 0.11767, 0.11323, 0.11335,
0.11267, 0.11098, 0.10751, 0.10698, 0.10684, 0.10928, 0.1089,
0.10764, 0.10056, 0.09559, 0.09648, 0.09531, 0.0943, 0.09277,
0.08542, 0.08315, 0.07432, 0.07523, 0.07335, 0.07358, 0.07323,
0.07433, 0.07611, 0.07517, 0.07387, 0.07573, 0.07559, 0.0712,
0.0701, 0.0662, 0.06954, 0.07125, 0.07021, 0.06932, 0.07309,
0.073, 0.0732, 0.07273, 0.07317, 0.074, 0.07531, 0.07681, 0.07934,
0.0757, 0.07448, 0.07179, 0.07405, 0.07721, 0.0763, 0.07491,
0.07546, 0.07561, 0.07502, 0.07573, 0.07638, 0.0769, 0.07732,
0.078, 0.07849, 0.07858, 0.07817, 0.07933, 0.08047, 0.08092,
0.0805, 0.07974, 0.07813, 0.0763, 0.07558, 0.07249, 0.07182,
0.07319, 0.0752, 0.07437, 0.07518, 0.07607, 0.07724, 0.07668,
0.07748, 0.07744, 0.07743, 0.07725, 0.07776, 0.07836, 0.07492,
0.07462, 0.07259, 0.07278, 0.07301, 0.07326, 0.0739, 0.07444,
0.07535, 0.07669, 0.07729, 0.07824, 0.07928, 0.07934, 0.08162,
0.08316), low = c(0.11978, 0.1178, 0.1172, 0.1201, 0.12178, 0.12205,
0.12212, 0.12193, 0.12048, 0.12058, 0.12257, 0.11896, 0.11811,
0.12107, 0.12117, 0.12129, 0.122, 0.12429, 0.1266, 0.12721, 0.1266,
0.12661, 0.12412, 0.12504, 0.12548, 0.12404, 0.1243, 0.12431,
0.12533, 0.12138, 0.12, 0.12036, 0.12059, 0.12162, 0.12222, 0.1203,
0.12148, 0.12103, 0.12313, 0.12225, 0.12175, 0.11411, 0.10467,
0.10653, 0.10525, 0.10507, 0.10529, 0.10833, 0.10878, 0.10316,
0.10021, 0.10294, 0.09925, 0.10017, 0.1003, 0.10126, 0.10326,
0.10373, 0.10133, 0.09563, 0.09632, 0.09935, 0.10089, 0.09973,
0.10072, 0.10144, 0.10297, 0.10316, 0.10421, 0.10231, 0.09465,
0.09572, 0.09618, 0.09773, 0.09974, 0.09863, 0.09931, 0.10089,
0.10076, 0.10128, 0.10143, 0.10196, 0.10253, 0.10498, 0.1053,
0.10303, 0.10376, 0.10452, 0.10154, 0.10024, 0.0996, 0.09903,
0.1002, 0.09738, 0.09778, 0.09941, 0.1003, 0.10007, 0.10095,
0.1027, 0.10753, 0.11202, 0.11312, 0.1108, 0.1097, 0.10787, 0.10805,
0.10945, 0.10915, 0.10955, 0.11154, 0.11255, 0.10815, 0.10594,
0.10556, 0.10715, 0.10988, 0.11185, 0.11061, 0.11198, 0.11243,
0.11368, 0.11125, 0.10968, 0.11047, 0.11069, 0.10627, 0.10495,
0.10497, 0.10559, 0.10482, 0.10695, 0.099, 0.09241, 0.09346,
0.09452, 0.08974, 0.09206, 0.08209, 0.08185, 0.07179, 0.06451,
0.06982, 0.06912, 0.06969, 0.06978, 0.07074, 0.07367, 0.07129,
0.07085, 0.071, 0.07051, 0.06847, 0.06405, 0.06267, 0.0644, 0.06819,
0.06828, 0.06762, 0.06881, 0.07029, 0.07149, 0.07066, 0.07069,
0.07232, 0.07344, 0.07382, 0.07435, 0.07163, 0.0697, 0.0698,
0.07053, 0.07294, 0.07338, 0.07073, 0.07214, 0.07394, 0.07241,
0.07208, 0.07436, 0.0751, 0.0757, 0.07623, 0.07703, 0.07535,
0.07524, 0.0776, 0.07782, 0.07924, 0.0789, 0.07693, 0.07389,
0.07411, 0.07132, 0.07025, 0.07026, 0.07008, 0.07264, 0.07324,
0.07341, 0.07425, 0.07435, 0.07507, 0.07561, 0.07569, 0.07585,
0.07574, 0.07585, 0.07335, 0.0722, 0.07157, 0.071, 0.0716, 0.07029,
0.07111, 0.07195, 0.07201, 0.07392, 0.07465, 0.07623, 0.07472,
0.0775, 0.07763, 0.07878, 0.08125), close = c(0.12167, 0.11791,
0.12137, 0.124, 0.12236, 0.12377, 0.12392, 0.12381, 0.12164,
0.12389, 0.12415, 0.11915, 0.12109, 0.1224, 0.1232, 0.12214,
0.12488, 0.12839, 0.1281, 0.12755, 0.12701, 0.12745, 0.12667,
0.12633, 0.12575, 0.12454, 0.12458, 0.12859, 0.12555, 0.1224,
0.12279, 0.12176, 0.12208, 0.12335, 0.12427, 0.12214, 0.1217,
0.12403, 0.12473, 0.12335, 0.1237, 0.11486, 0.11016, 0.10653,
0.10829, 0.10642, 0.10902, 0.10982, 0.10981, 0.10402, 0.10336,
0.104, 0.10134, 0.10268, 0.10199, 0.10358, 0.10443, 0.10513,
0.10274, 0.09678, 0.10175, 0.10115, 0.10107, 0.1022, 0.10152,
0.10517, 0.10362, 0.10465, 0.10576, 0.10422, 0.09695, 0.09657,
0.09841, 0.10165, 0.10065, 0.09993, 0.10115, 0.10199, 0.10155,
0.10233, 0.10212, 0.10274, 0.10594, 0.10571, 0.10572, 0.10405,
0.10609, 0.10478, 0.10286, 0.10132, 0.10018, 0.10025, 0.10122,
0.09857, 0.10011, 0.10051, 0.10072, 0.10155, 0.10333, 0.10762,
0.11307, 0.11414, 0.11527, 0.11241, 0.11021, 0.1093, 0.11005,
0.10972, 0.11176, 0.11385, 0.11405, 0.1129, 0.10851, 0.10746,
0.10777, 0.11022, 0.11558, 0.11485, 0.11349, 0.11465, 0.11569,
0.11527, 0.1119, 0.11233, 0.11197, 0.11084, 0.10661, 0.10556,
0.10664, 0.1064, 0.10863, 0.10743, 0.09959, 0.09358, 0.09525,
0.09484, 0.09361, 0.09215, 0.08424, 0.08281, 0.0727, 0.0706,
0.07001, 0.07005, 0.07199, 0.07117, 0.07421, 0.07469, 0.07327,
0.07132, 0.07559, 0.07097, 0.06862, 0.0647, 0.066, 0.06857, 0.07012,
0.06901, 0.06896, 0.0715, 0.07156, 0.07209, 0.07207, 0.07261,
0.07345, 0.07469, 0.07625, 0.0758, 0.07376, 0.07006, 0.07137,
0.07336, 0.07602, 0.07389, 0.07429, 0.0752, 0.07399, 0.07305,
0.07533, 0.07525, 0.0765, 0.07666, 0.07782, 0.07804, 0.07596,
0.07783, 0.07925, 0.07921, 0.08028, 0.07938, 0.0779, 0.07477,
0.07534, 0.07174, 0.07103, 0.07122, 0.07289, 0.07387, 0.07369,
0.07503, 0.07509, 0.07524, 0.07636, 0.07573, 0.07639, 0.07679,
0.07628, 0.0777, 0.07359, 0.07462, 0.07216, 0.07173, 0.07265,
0.07201, 0.07315, 0.07227, 0.07429, 0.07499, 0.07626, 0.07713,
0.07766, 0.07819, 0.07915, 0.08148, 0.08275), volume = c(17894295,
25956559, 19646834, 21073444, 18817421, 12316289, 11348380, 14945318,
20611382, 29389056, 15639183, 23990903, 10230550, 11791876, 8849962,
8712513, 17411436, 52294930, 13741243, 12159456, 10156693, 7392933,
24556017, 12498171, 6585602, 9053311, 10389994, 32763165, 18691599,
20920341, 17194082, 13384844, 10762647, 11238837, 20643490, 17826487,
8605881, 12725146, 8033532, 14576577, 18203767, 33106274, 57475480,
35090353, 19236551, 22848525, 19670114, 12209910, 9189784, 28139942,
32849205, 23256020, 31210609, 23094329, 12240627, 12774399, 8347728,
10614794, 13157648, 47509634, 20708007, 13009872, 5347605, 10099313,
18566517, 24284140, 16257416, 13504669, 26353561, 13722621, 42173001,
23675661, 8144656, 17929342, 9387011, 13854189, 14603858, 31616737,
6704224, 24196867, 13695017, 11613987, 27856536, 13454585, 10497017,
16458068, 16297639, 12785798, 19360445, 12732714, 10444114, 16201247,
9645137, 19007416, 14556473, 9980469, 8106055, 13820499, 10194965,
64253247, 161980227, 55008265, 62794334, 47634737, 27375292,
28948205, 23303586, 15667935, 20378324, 42039932, 45234586, 55979026,
38458874, 19968558, 11843244, 33406862, 42373158, 54126294, 46806385,
61654732, 27197944, 59155494, 33707242, 23832047, 19967177, 10957640,
15637922, 19658790, 13028772, 9082828, 24976755, 10789730, 39076951,
49842677, 16384967, 15601195, 29659625, 14836814, 53131858, 26904846,
50215911, 80446251, 31711637, 27684325, 18295756, 30244578, 25000228,
31701319, 20297596, 17620148, 16712144, 24532847, 20024178, 61355138,
49383309, 34613954, 15938600, 14048986, 9165050, 33670464, 28771619,
24220858, 11889148, 24206767, 16696844, 19341205, 30682562, 48411541,
31624605, 19583695, 7736058, 14697691, 20371228, 21601985, 14667855,
11662673, 8565838, 8950674, 15198713, 18115403, 13873815, 9454750,
13116891, 11227183, 17723342, 11168569, 17650051, 16902150, 16042595,
12631966, 17581570, 22259046, 16421002, 23295568, 15918092, 18004724,
24079621, 23097753, 12800081, 12312440, 13131810, 19374725, 14036774,
15552921, 12017393, 6465640, 6071254, 8288237, 23909383, 15594514,
13318570, 9361610, 7166725, 9715764, 8906698, 8078021, 8742947,
5312715, 8228518, 7468992, 21681712, 15425063, 9088154, 16051149,
14306452), trades = c(11591L, 13904L, 8770L, 8976L, 8889L, 7218L,
7956L, 10289L, 8338L, 15267L, 7974L, 11350L, 6627L, 8199L, 5462L,
5711L, 9750L, 27559L, 7345L, 7275L, 4761L, 4086L, 11405L, 7343L,
3511L, 5410L, 4619L, 14885L, 10363L, 11337L, 10040L, 7900L, 6029L,
6823L, 9894L, 9795L, 5252L, 8359L, 4739L, 8325L, 10895L, 17994L,
26704L, 16954L, 11073L, 11451L, 10072L, 6270L, 4694L, 13397L,
14960L, 9414L, 14906L, 12126L, 6198L, 5929L, 4447L, 4968L, 6663L,
19502L, 8574L, 6111L, 2793L, 4580L, 7616L, 11026L, 7975L, 6380L,
10178L, 7006L, 18590L, 11151L, 4108L, 7542L, 4110L, 7336L, 7791L,
14672L, 3764L, 12346L, 6006L, 6644L, 14171L, 6804L, 5282L, 7091L,
6975L, 7109L, 9196L, 7046L, 5131L, 7664L, 5566L, 9995L, 8029L,
4665L, 3391L, 5387L, 5661L, 21898L, 63727L, 23335L, 25023L, 22152L,
11598L, 12217L, 10815L, 6903L, 10246L, 25837L, 21694L, 21720L,
12474L, 8370L, 5376L, 15747L, 18057L, 20906L, 17232L, 25948L,
11954L, 24800L, 12686L, 9503L, 8451L, 6271L, 8233L, 10329L, 6095L,
5637L, 9733L, 6092L, 13746L, 19684L, 7050L, 6934L, 13457L, 7401L,
17572L, 11348L, 18615L, 25756L, 10412L, 10349L, 6128L, 12691L,
9583L, 10143L, 7123L, 7471L, 6147L, 10867L, 6986L, 14811L, 15151L,
9144L, 4273L, 4538L, 3426L, 9159L, 9095L, 8463L, 4558L, 7123L,
6183L, 6101L, 8886L, 16735L, 8368L, 6808L, 3165L, 5547L, 8119L,
9066L, 6105L, 5640L, 4008L, 4116L, 4971L, 6974L, 4911L, 3472L,
4044L, 4096L, 5997L, 4972L, 7099L, 7793L, 6059L, 4567L, 5282L,
6897L, 6491L, 10157L, 6830L, 6899L, 8623L, 9719L, 4053L, 4742L,
4628L, 7551L, 5978L, 7164L, 4851L, 3556L, 3060L, 3858L, 8498L,
6731L, 5812L, 3765L, 2530L, 3805L, 3734L, 4060L, 3785L, 2778L,
4578L, 4151L, 8128L, 7304L, 3698L, 7376L, 5582L), SMA_5 = c(NA,
NA, NA, NA, 0.121462, 0.121882, 0.123084, 0.123572, 0.1231, 0.123406,
0.123482, 0.122528, 0.121984, 0.122136, 0.121998, 0.121596, 0.122742,
0.124202, 0.125342, 0.126212, 0.127186, 0.1277, 0.127356, 0.127002,
0.126642, 0.126148, 0.125574, 0.125958, 0.125802, 0.125132, 0.124782,
0.124218, 0.122916, 0.122476, 0.12285, 0.12272, 0.122708, 0.123098,
0.123374, 0.12319, 0.123502, 0.122134, 0.11936, 0.11572, 0.112708,
0.109252, 0.108084, 0.108016, 0.108672, 0.107818, 0.107206, 0.106202,
0.104506, 0.10308, 0.102674, 0.102718, 0.102804, 0.103562, 0.103574,
0.102532, 0.102166, 0.10151, 0.100698, 0.10059, 0.101538, 0.102222,
0.102716, 0.103432, 0.104144, 0.104684, 0.10304, 0.10163, 0.100382,
0.09956, 0.098846, 0.099442, 0.100358, 0.101074, 0.101054, 0.10139,
0.101828, 0.102146, 0.102936, 0.103768, 0.104446, 0.104832, 0.105502,
0.10527, 0.1047, 0.10382, 0.103046, 0.101878, 0.101166, 0.100308,
0.100066, 0.100132, 0.100226, 0.100292, 0.101244, 0.102746, 0.105258,
0.107942, 0.110686, 0.112502, 0.11302, 0.112266, 0.111448, 0.110338,
0.110208, 0.110936, 0.111886, 0.112456, 0.112214, 0.111354, 0.110138,
0.109372, 0.109908, 0.111176, 0.112382, 0.113758, 0.114852, 0.11479,
0.1142, 0.113968, 0.113432, 0.112462, 0.11073, 0.109462, 0.108324,
0.10721, 0.106768, 0.106932, 0.105738, 0.103126, 0.100896, 0.098138,
0.095374, 0.093886, 0.092018, 0.08953, 0.085102, 0.0805, 0.076072,
0.073234, 0.07107, 0.070764, 0.071486, 0.072422, 0.073066, 0.072932,
0.073816, 0.073168, 0.071954, 0.07024, 0.069176, 0.067772, 0.067602,
0.06768, 0.068532, 0.069632, 0.07023, 0.070624, 0.071236, 0.071966,
0.072356, 0.072982, 0.073814, 0.07456, 0.07479, 0.074112, 0.073448,
0.07287, 0.072914, 0.07294, 0.073786, 0.074552, 0.074678, 0.074084,
0.074372, 0.074564, 0.074824, 0.075358, 0.076312, 0.076854, 0.076996,
0.077262, 0.07778, 0.078058, 0.078506, 0.07919, 0.079204, 0.078308,
0.077534, 0.075826, 0.074156, 0.07282, 0.072444, 0.07215, 0.07254,
0.07334, 0.074114, 0.074584, 0.075082, 0.07549, 0.075762, 0.076102,
0.07631, 0.076578, 0.07615, 0.075796, 0.07487, 0.07396, 0.07295,
0.072634, 0.07234, 0.072362, 0.072874, 0.073342, 0.074192, 0.074988,
0.076066, 0.076846, 0.077678, 0.078722, 0.079846), SMA_10 = c(NA,
NA, NA, NA, NA, NA, NA, NA, NA, 0.122434, 0.122682, 0.122806,
0.122778, 0.122618, 0.122702, 0.122539, 0.122635, 0.123093, 0.123739,
0.124105, 0.124391, 0.125221, 0.125779, 0.126172, 0.126427, 0.126667,
0.126637, 0.126657, 0.126402, 0.125887, 0.125465, 0.124896, 0.124437,
0.124139, 0.123991, 0.123751, 0.123463, 0.123007, 0.122925, 0.12302,
0.123111, 0.122421, 0.121229, 0.119547, 0.117949, 0.116377, 0.115109,
0.113688, 0.112196, 0.110263, 0.108229, 0.107143, 0.106261, 0.105876,
0.105246, 0.104962, 0.104503, 0.104034, 0.103327, 0.102603, 0.102442,
0.102157, 0.10213, 0.102082, 0.102035, 0.102194, 0.102113, 0.102065,
0.102367, 0.103111, 0.102631, 0.102173, 0.101907, 0.101852, 0.101765,
0.101241, 0.100994, 0.100728, 0.100307, 0.100118, 0.100635, 0.101252,
0.102005, 0.102411, 0.102918, 0.10333, 0.103824, 0.104103, 0.104234,
0.104133, 0.103939, 0.10369, 0.103218, 0.102504, 0.101943, 0.101589,
0.101052, 0.100729, 0.100776, 0.101406, 0.102695, 0.104084, 0.105489,
0.106873, 0.107883, 0.108762, 0.109695, 0.110512, 0.111355, 0.111978,
0.112076, 0.111952, 0.111276, 0.110781, 0.110537, 0.110629, 0.111182,
0.111695, 0.111868, 0.111948, 0.112112, 0.112349, 0.112688, 0.113175,
0.113595, 0.113657, 0.11276, 0.111831, 0.111146, 0.110321, 0.109615,
0.108831, 0.1076, 0.105725, 0.104053, 0.102453, 0.101153, 0.099812,
0.097572, 0.095213, 0.09162, 0.087937, 0.084979, 0.082626, 0.0803,
0.077933, 0.075993, 0.074247, 0.07315, 0.072001, 0.07229, 0.072327,
0.072188, 0.071653, 0.071054, 0.070794, 0.070385, 0.069817, 0.069386,
0.069404, 0.069001, 0.069113, 0.069458, 0.070249, 0.070994, 0.071606,
0.072219, 0.072898, 0.073378, 0.073234, 0.073215, 0.073342, 0.073737,
0.073865, 0.073949, 0.074, 0.073774, 0.073499, 0.073656, 0.074175,
0.074688, 0.075018, 0.075198, 0.075613, 0.07578, 0.076043, 0.076569,
0.077185, 0.07768, 0.078093, 0.078233, 0.078044, 0.077796, 0.077166,
0.076673, 0.076012, 0.075376, 0.074842, 0.074183, 0.073748, 0.073467,
0.073514, 0.073616, 0.074015, 0.074551, 0.075108, 0.075447, 0.07583,
0.07582, 0.075779, 0.075486, 0.075135, 0.074764, 0.074392, 0.074068,
0.073616, 0.073417, 0.073146, 0.073413, 0.073664, 0.074214, 0.07486,
0.07551, 0.076457, 0.077417), SMA_20 = c(NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.1232695,
0.1235365, 0.1240135, 0.1242785, 0.124395, 0.1245645, 0.124603,
0.124636, 0.124875, 0.1250705, 0.124996, 0.124928, 0.1250585,
0.125108, 0.1251555, 0.125209, 0.125209, 0.12505, 0.124832, 0.1246635,
0.1244535, 0.124288, 0.1236585, 0.122833, 0.121843, 0.12097,
0.120064, 0.119286, 0.1183475, 0.1175605, 0.1166415, 0.11567,
0.114782, 0.113745, 0.1127115, 0.1115975, 0.1106695, 0.109806,
0.108861, 0.1077615, 0.106433, 0.1053355, 0.10465, 0.1041955,
0.103979, 0.1036405, 0.103578, 0.103308, 0.1030495, 0.102847,
0.102857, 0.1025365, 0.102165, 0.1020185, 0.101967, 0.1019, 0.1017175,
0.1015535, 0.1013965, 0.101337, 0.1016145, 0.101633, 0.1017125,
0.101956, 0.1021315, 0.1023415, 0.1022855, 0.102409, 0.1024155,
0.1022705, 0.1021255, 0.102287, 0.102471, 0.1026115, 0.1024575,
0.1024305, 0.1024595, 0.102438, 0.102416, 0.102505, 0.1027695,
0.103317, 0.103887, 0.1043535, 0.1046885, 0.104913, 0.1051755,
0.1053735, 0.1056205, 0.1060655, 0.106692, 0.1073855, 0.108018,
0.1083825, 0.108827, 0.10921, 0.1096955, 0.1104385, 0.1111035,
0.1116115, 0.111963, 0.112094, 0.1121505, 0.111982, 0.111978,
0.112066, 0.112143, 0.111971, 0.111763, 0.111507, 0.1111345,
0.1108635, 0.11059, 0.110144, 0.10945, 0.108824, 0.108055, 0.1069565,
0.1058215, 0.104359, 0.102767, 0.1006175, 0.0983839999999999,
0.0962894999999999, 0.0941754999999999, 0.0921764999999999, 0.0901929999999999,
0.0885729999999999, 0.0870294999999999, 0.0853609999999999, 0.0836069999999999,
0.0819549999999999, 0.0801319999999999, 0.0785834999999999, 0.0771394999999999,
0.0756769999999999, 0.0743634999999999, 0.0731889999999999, 0.0720319999999999,
0.0712679999999999, 0.0707024999999999, 0.0706454999999999, 0.0707199999999999,
0.0708229999999999, 0.0709509999999999, 0.0710239999999999, 0.0711999999999999,
0.0713019999999999, 0.0713574999999999, 0.0713819999999999, 0.0713189999999999,
0.0711079999999999, 0.0712274999999999, 0.0715974999999999, 0.0720569999999999,
0.0724714999999999, 0.0728029999999999, 0.0729964999999999, 0.0731984999999999,
0.0735169999999999, 0.0737044999999999, 0.0739514999999999, 0.0741799999999999,
0.0744674999999999, 0.0747389999999999, 0.0748644999999999, 0.0750214999999999,
0.0751714999999999, 0.0753419999999999, 0.0756679999999999, 0.0761339999999999,
0.0764604999999999, 0.0765309999999999, 0.0764969999999999, 0.0763894999999999,
0.0762264999999999, 0.0760274999999999, 0.0759724999999999, 0.0760134999999999,
0.0759314999999999, 0.0759204999999999, 0.0758499999999999, 0.0757789999999999,
0.0757059999999999, 0.0755904999999999, 0.0756119999999999, 0.0755599999999999,
0.0754114999999999, 0.0753359999999999, 0.0750014999999999, 0.0747634999999999,
0.0744764999999999, 0.0743244999999999, 0.0741899999999999, 0.0742034999999999,
0.0743094999999999, 0.0743619999999999, 0.0744319999999999, 0.0744879999999999,
0.0746164999999999, 0.0747214999999999, 0.0748499999999999, 0.0749974999999999,
0.0751369999999999, 0.0754244999999999, 0.0757424999999999)), row.names = c(NA,
-225L), class = c("data.table", "data.frame"), .internal.selfref = <pointer: 0x00000000105f1ef0>)
What I want is to connect the two highest highs and expand the line across all the x-axis. Here's the code to get that data:
highs <- arrange(sma, desc(high))%>%
slice(1:2)
highs
time open high low close volume trades SMA_5 SMA_10 SMA_20
1: 2022-01-01 10:00:00 0.12488 0.13202 0.12429 0.12839 52294930 27559 0.124202 0.123093 NA
2: 2022-01-03 02:00:00 0.12455 0.12930 0.12431 0.12859 32763165 14885 0.125958 0.126657 0.124875
So basically I have 0.13202 from January 1st and 0.12930 from January 3rd as my highest highs. With some code such as:
add_lines(inherit = F, data = highs, x = ~time, y = ~high,
name = "Higher highs trendline", line = list(color = "seagreen", width = 2.5, dash = "dot"))
I can draw the line exactly for the two points in my highs object. But what I want is that this line goes across all my graph. In short, given two points I want to draw a trendline the same way we used to do on basic algebra. Main code for my graph is:
sma %>% plot_ly(x = ~time, type="candlestick",
open = ~open, close = ~close,
high = ~high, low = ~low) %>%
add_lines(x = ~time, y= ~SMA_5, line = list(color = "gold", width = 2), inherit = F,
name = "SMA 5", showlegend=T)%>%
add_lines(x = ~time, y= ~SMA_10, line = list(color = "deeppink", width = 2), inherit = F,
name = "SMA 10", showlegend=T)%>%
add_lines(x = ~time, y= ~SMA_20, line = list(color = "purple", width = 2), inherit = F,
name = "SMA 20", showlegend=T)%>%
plotly::layout(title = paste0(nombre, " Simple Moving Average, ", tiempo),
xaxis= list(title="Time", rangeslider = list(visible = F)), yaxis = list(title = "Price"),
sliders=list(visible=F)) -> sma_
Any help and orientation will be much appreciated.
You could fit a linear model on the two high points, and predict it's values on the remaining dataset:
fit <- lm(high ~ time, data = highs)
sma %>% plot_ly(x = ~time, type="candlestick",
open = ~open, close = ~close,
high = ~high, low = ~low) %>%
add_lines( x = ~time, y = ~predict(fit,sma))

linearly ranking values from 0:10 in r

I have the following dataset:
structure(list(G = c(NA, NA, -1.01182174807081, -1.01182174807081,
-1.01182174807081, -1.03501949560312, -1.03501949560312, -1.03501949560312,
-1.01189555194367, -1.01189555194367, -1.01189555194367, -1.03208191284692,
-1.03208191284692, -1.03208191284692, -1.00007825695672, -1.00007825695672,
-1.00007825695672, -1.03027247563088, -1.03027247563088, -1.03027247563088,
-0.999632960176179, -0.999632960176179, -0.999632960176179, -0.998570208055593,
-0.998570208055593, -0.998570208055593, -0.975978344319463, -0.975978344319463,
-0.975978344319463, -0.984342844790316, -0.984342844790316, -0.984342844790316,
-0.998450245287518, -0.998450245287518, -0.998450245287518, -1.11255680134788,
-1.11255680134788, -1.11255680134788, -1.14437105346841, -1.14437105346841,
-1.14437105346841, -1.24738311047776, -1.24738311047776, -1.24738311047776,
-1.28564738896258, -1.28564738896258, -1.28564738896258, -1.30225611704836,
-1.30225611704836, -1.30225611704836, -1.17181860494129, -1.17181860494129,
-1.17181860494129, -1.15687952410288, -1.15687952410288, -1.15687952410288,
-1.12078874426169, -1.12078874426169, -1.12078874426169, -1.12194837414298,
-1.12194837414298, -1.12194837414298, -1.1119085686834, -1.1119085686834,
-1.1119085686834, -1.11460209275208, -1.11460209275208, -1.11460209275208,
-1.14030482631462, -1.14030482631462, -1.14030482631462, -1.25693845068723,
-1.25693845068723, -1.25693845068723, -1.29636270710907, -1.29636270710907,
-1.29636270710907, -1.28630939351124, -1.28630939351124, -1.28630939351124,
-1.34123496736839, -1.34123496736839, -1.34123496736839, -1.30208113084414,
-1.30208113084414, -1.30208113084414, -1.27472858798502, -1.27472858798502,
-1.27472858798502, -1.2601313178257, -1.2601313178257, -1.2601313178257,
-1.25435070950356, -1.25435070950356, -1.25435070950356, -1.25446776571291,
-1.25446776571291, -1.25446776571291, -1.31782396761758, -1.31782396761758,
-1.31782396761758, -1.32404892123336, -1.32404892123336, -1.32404892123336,
-1.35533362583485, -1.35533362583485, -1.35533362583485, -1.32224476611552,
-1.32224476611552, -1.32224476611552, -1.37165859726789, -1.37165859726789,
-1.37165859726789, -1.32061051911721, -1.32061051911721, -1.32061051911721,
-1.26156328360682, -1.26156328360682, -1.26156328360682, -1.26156328360682,
-1.26156328360682, NA, NA)), class = c("tbl_df", "tbl", "data.frame"
), row.names = c(NA, -123L))
What I want is to rank every value 0 to 10, where 0 should equal the highest value (-0.9759783) and 10 should be the lowest value (-1.37166). Everything in between should be ranked linearly so that, for example, -1.25693845068723 should yield 7.1 and so on.
Thanks in advance.

R Find Full width at half maximum for a gausian density distribution

I have a data set (come from reality) like
a<-c(12.4314579038074, 30.1197692762127, 31.8986680511062, 21.5000657793742,
24.2201952026304, 21.4083286311931, 30.543892400514, 11.3243039196637,
18.6629847817322, 68.5846251690826, 8.15853135278713, 20.0269675183568,
23.761746451965, 15.7934365856289, 20.2308964167179, 16.1739058219803,
16.80324393405, 17.8825865979249, 11.4033338599819, 24.6766819397457,
21.6401012626284, 34.9473576269376, 21.2387163543256, 38.8393540982342,
11.1324409747932, 27.9691456747847, 35.0247764515163, 25.2955953655814,
20.1144847120957, 21.601935342838, NA, 37.0382391253826, 23.0768070922688,
29.7978557208652, 25.5629412341385, 52.3688195218551, 24.3278804498841,
24.5473987167943, 18.7003825260279, 7.59034179685435, 30.3494564815945,
11.9464422720518, 31.1286124512956, 35.6013073091488, 59.7732211526442,
18.1103630173406, 23.6991128199505, 35.0041638638631, 32.3290441334575,
9.96009633874818, 31.9439199749795, 17.2338813393175, 19.4703069779573,
40.0710364677356, 21.9784578364056, 14.8391748404154, 36.699595515976,
8.23000952339805, 29.3936574804397, 16.608043366678, 31.8893140469488,
25.0034860781714, 5.85410045445957, 33.6738722502197, 19.8719119513059,
16.5220779562036, 18.5998514048289, 26.2005902882878, NA, 24.6566247442218,
27.0333844562812, 14.886428829687, 17.5724702275547, 26.2137775245073,
19.0507021982012, 10.9566296835514, 26.6958883379168, 7.96499401119146,
26.1859738026908, 17.660793443073, 24.2581780545893, 13.2116252996823,
20.8404415084083, 13.9759556218075, 8.08290201929875, 19.577431906635,
30.8617872452287, 17.659162045328, 19.6553312413463, 54.5228181855605,
8.61384429381566, 8.57902103633537, 14.3833198356842, 44.6520928899702,
50.1684992597442, 19.1839092769506, 14.1859756348872, 22.319616459382,
7.04281719040295, 19.9734034824111, 26.5179176521408, 13.1611965717225,
16.9098287156019, 28.9883554716117, 26.0468146958332, 29.6763235030978,
48.7345046631538, 38.4339027762459, 31.2090734875574, 15.9385304470886,
12.8921108018056, 10.9673039456914, 10.3743768429606, 25.9387376803067,
NA, 11.5544889726556, 18.7480106738499, 13.2374072159457, 16.0463683223854,
13.6394902895386, 19.6499476784153, 19.6653905961478, 22.6713289483346,
30.0530150121339, 39.2413167843811, 29.7476825791523, 67.017937817938,
6.75394239192403, 13.8315465658099, 15.6479984367677, 11.6595078158563,
16.6153046740276, 29.1944136335659, 20.0699193532974, 23.0964604145297,
16.4642724437565, 31.4384175748718, 24.9125640407848, 25.0969240666473,
32.7585005489893, 28.2005135471151, 11.6928832972854, 29.0925157165188,
27.1449795674534, 19.7174609825609, 11.3155221077222, 13.8725373098617,
10.4058292934838, 20.5471528311623, 24.593775927458, 24.5992797334339,
25.7621705532288, 19.429523059737, 23.7267657702523, 26.8378886664471,
33.0405101400995, 33.8244308994044, 23.923384237542, 10.1422998835261,
8.36171095318636, 31.7070531272099, 29.7732770732215, 24.8822351146394,
5.02000303147286, 12.8561338422933, 19.9693656971446, 19.599345558469,
22.1630854796563, 22.3226724168097, 32.0046288304837, 9.97036087568324,
17.9532401992864, 27.5200598557606, 18.2493582809349, 19.516614679827,
8.73100033494884, 9.92568752683278, 36.111580524921, 26.5447538548956,
31.5801048764258, 30.7784315713327, 43.9917658205537, 5.88518831155849,
38.6914615372257, 22.4450167569794, 38.471255777786, 17.8759146100263,
42.1237669506763, 40.8120103320423, 50.9620878359755, 24.8723162387534,
28.281137488787, 21.1047200631107, NA, 35.6445176565107, NA,
22.4329601563967, 17.1865147962927, 34.6207419910748, 27.488098898296,
40.647159426457, 49.0566470559664, 25.2404304347901, 28.9937264113381,
14.0652751682648, 16.8982448551594, NA, NA, 38.7092724982844,
51.3923484671426, 56.2948963516975, 17.6784549803966, 21.346370069203,
40.5568626421931, 11.5473392102776, 29.8901196029765, 55.8045368249135,
32.5629692658593, 15.7151398771352, 50.69539004787, 28.6630956503548,
NA, 33.745363485143, 30.1793575796192, 31.5239871763176, 23.413715020835,
28.4068815777865, 26.628933941261, 28.8040299272661, 38.7590176170059,
28.5895707604946, 27.3163626291958, 22.4432050319593, 22.8717709770244,
15.5769117905467, 16.6205562869212, 19.6461009184912, 28.112145862862,
22.4817869475301, 11.9911595195158, 27.7864754526246, 32.110827889238,
38.6601905078103, 26.5431928219843, 37.5022713181254, 20.1507313327997,
26.1701491671608, 13.5713776019221, 24.9836498596017, 21.2698715590683,
25.0155871471049, 33.7177860466273, NA, 13.9496573767241, 16.1150625739034,
16.6382037385219, 38.0327684962353, 15.4336346869134, 28.2741877552971,
18.3988010783219, 46.8872039734549, 39.6400155384279, 42.2346150067755,
23.8766379243586, 20.6388991126635, 13.4323233360809, 25.7328268912762,
18.5198704804179, 35.1253893334279, 50.4960266232654, 22.8606920846386,
16.1816315814691, 24.404001970632, 12.7156971608144, 16.1868830629463,
30.2499403084286, 49.7785508137954, 33.2123299816736, NA, 12.9230946451066,
7.08427169664578, 10.0671158815277, 19.7294071616146, 30.8425354787526,
38.3145455434934, 16.7030543796463, 12.1822921506718, 24.8419226234385,
NA, 19.6863906566313, 24.8415166763613, 27.2222764218966, 25.4530639943619,
24.3584061455177, 21.6932253013582, 26.6862568289173, 10.4439641151796,
8.16828313448626, 24.7764905211242, 24.0153889448978, 42.27494669877,
23.1024890766068, 12.5421984383058, 28.126105527251, 11.7477790609559,
37.8210140575854, 16.2510203840877, 29.5179896530944, 19.767113140873,
21.180255311345, 50.1326402088336, 46.9411426142246, 22.1825770399621,
38.3217563655723, 32.8198922751461, 18.1215432904772, 36.7957509446084,
31.0953183824079, 41.2683134903454, 27.3369679280893, 18.6814450240623,
40.9365261829113, 31.3995794910782, 45.3773497997797, 29.7809299163648,
25.6494347188067, 12.2371700316698, 24.028235743912, 20.2190137194663,
63.5048123597575, 19.4212679708406, 28.2540327945574, 15.6824059299007,
26.4502584835429, 25.6747019832926, 21.3448542479901, 21.5398949527062,
15.0453039478043, 15.435237823288, 21.9433429596872, 22.4942864667832,
19.2699097293276, 13.7352833513297, 17.2542472110831, 47.1631828020397,
43.0112020075035, 16.3372108879913, 24.2918076279655, 26.4439880171655,
23.1117247311131, 36.6759437723188, 43.6176498793953, 32.0130676806535,
30.6326404095052, 10.8268556221906, 52.7653604760821, 8.91595447346234,
13.193539457832, 7.68418008204124, 15.449010979906, 30.9584089126334,
51.9422244686175, 15.8458479496976, 14.1047956442756, 17.5191070473658,
31.7011704471313, 14.8239075593942, 26.6479556968534, 12.7304068904724,
21.6484498326962, 18.5454691264783, 19.7417604612319, 17.4178392306296,
18.6961734797299, 16.6762708630409, 25.5769497729958, 20.4324858725377,
48.0108296588978, 22.3873783217253, 61.8180303957998, 60.9275917236957,
33.6030207132321, NA, 35.5927559357877, 20.7557420025042, 45.0952627270979,
33.7073022209601, 23.7276388907278, 44.0279966951556, 18.4465734471124,
35.376096916925, 11.049064991332, 6.38266176887074, 27.770464922835,
14.3280667570411, 18.2895352437716, 11.8697485564632, 11.9115403522214,
23.8995147554712, 22.9524551093465, 41.5537350356802, 8.32663490566077,
41.2800566378259, 37.616909008102, 13.9220837749745, 53.4996016880608,
38.0527622385737, 36.2584535594006, 31.3674093196625, 24.2902569424465,
21.440394745746, 32.2127828476281, 22.1521432796998, 16.4186950681111,
10.4937514476589, 32.4071007810483, 24.498045100507, 25.4241096355652,
9.73946952507465, 21.4041253422142, 28.8926165924432, 34.512959841434,
30.0571573052611, 22.4907629383951, 20.2211187443641, 16.8118098933704,
23.5285775050765, 39.4440966466874, 33.2825067066343, 36.8830992125003,
21.1282934201697, 18.6272972241037, 15.3140799736706, 40.0011498958142,
10.0182747888065, 15.3706553616215, 41.9509134815123, 22.303622817723,
19.2424468127472, 35.0099989943938, 16.6900077828908, 23.4847012508485,
22.9601479739565, 13.7682136158064, 20.0454049113627, 27.7179470144016,
43.7485548044574, 27.7379261226753, 32.1756980668739, 32.8029836110017,
30.2392324390705, 31.3156918552083, 32.1847331854615, 20.5297104164335,
50.9569341153107, 42.6081618367459, 18.636321910844, 12.4308178035891,
26.6917378844734, 5.76426461481125, 25.0767930273219, 24.2457959380206,
11.3931924451717, 19.077483646119, 12.0287714622052, 13.8729173763677,
15.940072198383, 31.9320584106662, 16.1008550559317, 35.8212131776284,
15.2435052118809, 3.44730091866671, 13.2863037128651, 33.2528958365812,
23.0426972188497, 31.9040632994659, 21.2588079706295, 9.56009250089547,
37.0841912585872, 21.7862379679352, 12.5945799997629, 11.9204901690358,
34.2003866802345, 22.1076801376058, 14.7504409350283, 12.2988895790339,
37.4743876245349, 4.40070781544351, 27.47718305659, 45.3352312111182,
44.7238582623121, 30.1074154853725, 25.3584692242304, 18.2894817200095,
39.6668104206319, 15.1780135384362, 8.90023187782675, 12.695608490357,
7.97231909106364, 18.0254627826149, 37.1330399717644, 40.3814619400626,
15.7530424414729, 26.4871843271195, 11.3849905569825, 14.4310436716623,
15.7889776729542, 15.3189979064802, 8.14775366334019, 21.3763917473048,
19.4271587027591, 8.17415804490136, 8.56927307423665, 9.9955524608618,
15.5450134422331, 10.823091946932, 8.44824243438286, 4.43490646514755,
5.47934855653405, 7.23626623411468, 25.3530745380911, 24.3179916472365,
18.7488727821045, 32.190181880216, 20.3023247566628, 16.5179670640049,
13.5756284381254, 16.6579681190254, 31.1737441837392, 26.4445566581656,
19.0657083835412, 9.02756346026971, 13.8198542042488, 19.5572751031157,
15.9815268564019, 21.2096031612745, 23.1965642826673, 22.9413587497691,
54.0401136217987, 14.3385183237915, 9.56798831205209, 16.8699681496442,
15.9839479181869, 13.6433809778083, 11.6657052013993, 33.293408496818,
22.5090700291058, 19.3612583830867, 14.4092661794021, 17.9685233644732,
5.41812657103551, 5.85301279046166, 16.4916538514991, 32.8886078034163,
42.5319945344839, 6.96221532796392, 10.8250789766828, 14.0362434679265,
13.4236572258544, 8.18430437430949, 8.49810493010364, 19.9805220462551,
7.99530774694417, 7.7257996525705, 29.0351171682388, 4.33760495695362,
17.6928347163945, 10.1142902669032, 6.06249165375458, 4.74850565714552,
17.9833699614403, 67.2065822391264, 17.3347810074396, 16.5017818986004,
23.7514924365845, 37.1851342775933, 21.5618045488646, 30.6788445864795,
17.1035593022782, 8.42714630237048, 13.4006384220441, 22.1238974112126,
4.48001569435593, 23.9658029257865, 6.23907173530781, 26.877146564602,
15.3003261751959, 12.0485155125301, 4.32690092924821, 7.01214075444578,
16.1791317461962, 13.0728785273578, 7.63109083309118, 16.9972980214674,
8.30295245274037, 8.7770203067377, 5.67480760942735, 21.3961492360836,
13.9550988566784, 11.0242554066141, 19.4382013687556, 8.62975825045164,
11.4164507143039, 8.34586383704729, 3.72091720855698, 8.97296101792361,
29.8903858240922, 2.32504604168462, 25.8164695705562, 22.061057520145,
3.4803762605344, 48.3170810944539, 80.6701146444289, 15.0833362411301,
10.8924796349525, 17.4918647333209, 12.6115824242011, 34.3062414327012,
8.287617251304, 15.4831104293005, 15.1485432894085, 4.5184565189416,
3.59999333029852, 3.66865483560892, 29.9677778375668, 34.4509226015574,
32.5918276015502, 10.6060279795247, 19.7913453571932, 28.266459587366,
19.6122992848655, 9.57523706552828, 9.04738999444933, 5.25824593606435,
6.55473931337678, 18.7449471987719, 9.27943740426736, 9.54703445889029,
3.43647048217306, 17.6920729261708, 25.3789409935332, 43.0995071399241,
15.7776713016551, 5.96178566715426, 7.04629857379702, 40.3659823950032,
20.3090509981183, 14.0833358445997, 16.9522805698219, 40.8824485009689,
21.6424431028975, 11.0653580862889, 9.52636056796406, 13.2093186951614,
11.180272835061, 28.7154955728657, NA, 8.29026375001596, 30.2969947814111,
29.9276371600909, 8.84477707628671, 34.8718762912212, 33.7483835972703,
34.2724400573937, 10.0767436084755, 15.4873945381221, 26.7642017413928,
51.0184704255941, 13.3969350777478, 26.0049124989409, 24.4542678955175,
15.3254947646799, 27.6832229022455, 30.8718044931518, 19.7152850968778,
39.1363812987409, 3.27215259879083, 15.0217151381093, 5.81934884447124,
30.0083825574588, 12.8728048546551, 39.6060296728825, 25.1813163765464,
44.1868459510693, 56.2542657142314, 12.8977291749907, 45.114989387575,
48.6359576292684, 13.6879551288472, 20.8800721437086, 21.1718129052816,
18.1109547325148, 30.6495392873229, 16.6778394456472, 28.4355940709725,
40.2732033692905, 16.0324459813519, 21.6715649249579, 21.5745121789595,
41.0491368236404, 23.1897670150996, 38.6763733544082, 28.2952020362427,
14.9775146624242, 17.0529816156432, 21.3182907083993, 58.5980139524611,
34.1182365536438, 66.2307408341237, 10.0250215641074, 19.2484140780393,
36.1794806395077, 13.3664708666649, 43.0162594869992, 14.6768584506211,
14.3681241887621, 21.6991390370549, 19.3686839558787, 18.0066235564319,
26.4208759599778, 8.02575642257494, 6.45796803589213, 11.3672996291157,
14.4629853700209, 22.159295359166, 9.48235040640243, 28.0483346879341,
18.7791600825367, 19.7502447289479, 6.97410234941009, 15.552802250357,
13.3419372146528, 27.5115005559368, 6.97909930700005, NA, 7.05260541598179,
35.7722821782854, 36.7903676155688, 49.4540597647083, 25.2948226594315,
10.1520912497611, 13.4494123507724, 4.619799633406, 22.0861395692476,
14.2039171171824, 26.9952012939039, 9.36273697960081, 36.3471521574781,
17.1331241745133, 36.2783284115396, 23.2266827910025, 32.5915815527522,
31.2871980610003, 16.0233005517923, 23.600172770202, 18.2722026855851,
25.6024146453473, 20.9881450301547, 14.2228275030676, 9.41424245694267,
10.816472087346, 9.04870233666866, 28.2892191586388, 35.0753624317,
20.804631336334, 16.4586859700612, 18.4239500923344, 6.3386546363293,
6.49433203538962, 9.82250938112426, 21.4723821170409, 17.8374467840815,
35.0187346487592, 16.6827994374155, 10.1793943910258, 20.5493611125065,
15.7669268485395, 11.1870666093615, 9.10959979062923, 18.6380321376242,
10.0704206578543, 12.5407783691327, 34.8148633389888, 28.084370623971,
4.13200285250811, 30.1892030192568, 55.4882769575542, 35.7133359116889,
25.7829535423758, 24.3427532329746, 26.1373088326654, 12.8559165605457,
13.4759287411954, 45.973341582547, 16.3120873890776, 11.9948065461913,
7.92837707316941, 32.2209508527388, 17.166801717345, 22.4859349413392,
30.5941859604216, 10.9778157606133, 70.2748062001235, 21.5991697951828,
25.7831959948602, 1.43209618416462, 56.1235033644788, 24.4226310541958,
20.9224949050978, 36.3840952118939, 35.7276159685088, 37.6827740210086,
23.5299198435553, 13.6851209030389, 25.5335190230571, 45.4755511169848,
14.6080811491954, 14.2316318552737, 13.339561577062, 45.9187643234812,
24.9990910216492, 8.29483649953895, 23.5418927144432, 37.7936234851124,
12.70652449092, 28.7414210264296, 13.77474354302, 40.7185271359513,
13.2888748806108, 18.1136413518116, 48.3746826507517, NA, 12.1384015733918,
19.9658506537594, 13.1441032684027, 26.6795046532402, 11.9603093870165,
4.66530121380388, 19.473270220492, 27.5276898686734, 18.937349603982,
18.8155543455793, 13.4728520043676, 12.7940590426415, 16.6697994573555,
21.3583533715887, 42.5731745705282, 11.3851614825814, 16.7458126574673,
15.6740255937648, 16.6703517164138, 62.8179873937814, 21.6206878297099,
46.9610219140348, 53.40123532387, 40.092219470411, 37.8805373833002,
28.6457545722248, 20.6694999165836, 17.8624286041768, 28.5861053418492,
17.9939250048543, 37.3414460735396, 16.09898942567, 51.9310125086572,
19.7924905322066, 14.0565954639482, 46.864231594175, 20.7054727206452,
51.6787725408675, 37.6405519392879, 23.8641295161859, 14.714628026623,
10.3999093904835, 28.3638116333964, 29.5945043539217, 15.3139943100935
)
Than when I plot a curve density with ggplot
density_plot<-ggplot(data =a, aes(x=truc))+
geom_density(binwidth=5, alpha=.5, position="identity")
I get this graph
I have 2 questions :
it's look like a gausian ... whitch tool can I use for play with that?
I would like (if it's possible) to determine the Full width at half maximum (FWHM) to determine a model space (come from simulations) interesting to explore.
I have find normalmixEM from mixtools package the made that (I'm not sure to understand how it work).
fit = normalmixEM(a)
Erreur dans if (any(s.hyp == 0)) s.hyp[which(s.hyp == 0)] = runif(sum(s.hyp == :
valeur manquante là où TRUE / FALSE est requis
What the good way to calcul de FWHM ?
Thank's
E
That plot doesn't look like a normal distribution at all to me. The distribution looks right-skewed. Anyway, that's not relevant:
d <- density(na.omit(a), n=1e4)
plot(d)
xmax <- d$x[d$y==max(d$y)]
x1 <- d$x[d$x < xmax][which.min(abs(d$y[d$x < xmax]-max(d$y)/2))]
x2 <- d$x[d$x > xmax][which.min(abs(d$y[d$x > xmax]-max(d$y)/2))]
points(c(x1, x2), c(d$y[d$x==x1], d$y[d$x==x2]), col="red")
FWHM <- x2-x1
#[1] 25.71115

How to remove NA values in vector in R [duplicate]

This question already has answers here:
Remove NA values from a vector
(8 answers)
Closed 8 years ago.
I have a vector which stores over 1000 values. The first 50 values are NAs, how can I get rid of it?
c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, 1.5741, 1.583, 1.605, 1.633, 1.6465, 1.6475, 1.6329,
1.6413, 1.685, 1.692, 1.7087, 1.7055, 1.6985, 1.6807, 1.6745,
1.673, 1.6625, 1.6805, 1.689, 1.667, 1.684, 1.6675, 1.6867, 1.6688,
1.6643, 1.6685, 1.7025, 1.737, 1.7663, 1.742, 1.7535, 1.749,
1.7494, 1.75, 1.711, 1.7145, 1.7205, 1.751, 1.7295, 1.7205, 1.7325,
1.731, 1.7235, 1.712, 1.6967, 1.6872, 1.696, 1.7354, 1.729, 1.712,
1.7208, 1.7115, 1.7035, 1.7032, 1.6947, 1.715, 1.7181, 1.742,
1.7471, 1.7438, 1.7493, 1.7525, 1.773, 1.7695, 1.7735, 1.7895,
1.7905, 1.7945, 1.798, 1.8138, 1.791, 1.7915, 1.802, 1.7812,
1.7925, 1.7873, 1.7952, 1.808, 1.8265, 1.8369, 1.83, 1.8347,
1.826, 1.8079, 1.8165, 1.8104, 1.8333, 1.7864, 1.7878, 1.801,
1.79, 1.7745, 1.7493, 1.7625, 1.7575, 1.739, 1.7615, 1.739, 1.7521,
1.752, 1.7445, 1.7585, 1.7375, 1.7188, 1.709, 1.7092, 1.7154,
1.7273, 1.724, 1.7323, 1.7365, 1.7495, 1.7643, 1.8165, 1.811,
1.7395, 1.7365, 1.749, 1.7485, 1.748, 1.738, 1.743, 1.747, 1.7457,
1.7375, 1.738, 1.7391, 1.7155, 1.6909, 1.6953, 1.6984, 1.6795,
1.6885, 1.672, 1.669, 1.6815, 1.6895, 1.6855, 1.6697, 1.6845,
1.683, 1.6865, 1.6715, 1.6628, 1.6687, 1.6674, 1.6638, 1.682,
1.6825, 1.6953, 1.6915, 1.6955, 1.69, 1.7, 1.7105, 1.704, 1.705,
1.6867, 1.6917, 1.6954, 1.71, 1.702, 1.6985, 1.7185, 1.6898,
1.6725, 1.6725, 1.6515, 1.6305, 1.6355, 1.642, 1.631, 1.6425,
1.6375, 1.6355, 1.634, 1.6285, 1.6358, 1.6069, 1.602, 1.5995,
1.595, 1.582, 1.584, 1.5825, 1.6193, 1.6163, 1.6248, 1.6073,
1.615, 1.6125, 1.5865, 1.5718, 1.5714, 1.575, 1.579, 1.5835,
1.586, 1.5774, 1.5755, 1.5715, 1.557, 1.5345, 1.5115, 1.5208,
1.508, 1.5175, 1.5165, 1.517, 1.5268, 1.5444, 1.5195, 1.518,
1.5135, 1.5658, 1.583, 1.5757, 1.5945, 1.6245, 1.6135, 1.609,
1.5923, 1.586, 1.5915, 1.6032, 1.5893, 1.6125, 1.5965, 1.5972,
1.6142, 1.6085, 1.5995, 1.5907, 1.585, 1.5755, 1.563, 1.5768,
1.5917, 1.607, 1.6273, 1.623, 1.6223, 1.6455, 1.6438, 1.6435,
1.653, 1.6518, 1.647, 1.651, 1.6415, 1.6367, 1.6415, 1.6579,
1.672, 1.6737, 1.669, 1.6615, 1.6715, 1.663, 1.668, 1.6665, 1.662,
1.6495, 1.649, 1.6715, 1.6725, 1.6691, 1.6655, 1.6502, 1.6605,
1.6425, 1.6465, 1.645, 1.6545, 1.644, 1.6231, 1.6245, 1.6243,
1.6256, 1.616, 1.637, 1.6572, 1.652, 1.663, 1.669, 1.6685, 1.6693,
1.667, 1.6633, 1.662, 1.6495, 1.6525, 1.6545, 1.6588, 1.6495,
1.6395, 1.6482, 1.6391, 1.629, 1.637, 1.6462, 1.64, 1.6235, 1.6165,
1.6105, 1.6125, 1.5965, 1.5907, 1.6027, 1.6145, 1.6175, 1.6135,
1.6125, 1.639, 1.629, 1.607, 1.612, 1.6051, 1.6049, 1.603, 1.588,
1.5883, 1.591, 1.5944, 1.5793, 1.577, 1.575, 1.5645, 1.5769,
1.5665, 1.5737, 1.5665, 1.5639, 1.5504, 1.5402, 1.536, 1.5158,
1.5246, 1.5215, 1.5102, 1.5183, 1.5117, 1.4945, 1.4945, 1.5135,
1.495, 1.4772, 1.4832, 1.4793, 1.4785, 1.4589, 1.4965, 1.4865,
1.4872, 1.4835, 1.5037, 1.4815, 1.4745, 1.4815, 1.4835, 1.478,
1.4753, 1.475, 1.4775, 1.477, 1.4707, 1.4661, 1.4684, 1.4626,
1.4558, 1.467, 1.463, 1.4568, 1.453, 1.4478, 1.4275, 1.4035,
1.399, 1.4065, 1.4083, 1.4062, 1.4001, 1.3924, 1.3915, 1.4133,
1.4032, 1.4015, 1.3908, 1.41, 1.4095, 1.4482, 1.483, 1.4862,
1.524, 1.4861, 1.5, 1.4815, 1.4938, 1.5, 1.486, 1.484, 1.451,
1.424, 1.417, 1.4235, 1.409, 1.4164, 1.432, 1.4435, 1.4728, 1.493,
1.4685, 1.47, 1.466, 1.4526, 1.4815, 1.4875, 1.5215, 1.5105,
1.5063, 1.5318, 1.537, 1.5345, 1.5374, 1.538, 1.5362, 1.569,
1.5625, 1.569, 1.5795, 1.5945, 1.589, 1.594, 1.5845, 1.5875,
1.567, 1.5885, 1.5995, 1.597, 1.5795, 1.599, 1.6002, 1.6015,
1.5935, 1.5955, 1.6005, 1.5945, 1.576, 1.5705, 1.5818, 1.596,
1.5625, 1.5575, 1.5665, 1.579, 1.5775, 1.569, 1.5675, 1.554,
1.5605, 1.566, 1.567, 1.5875, 1.5945, 1.598, 1.6092, 1.617, 1.6142,
1.6195, 1.637, 1.6265, 1.6345, 1.635, 1.639, 1.6305, 1.6325,
1.6325, 1.6195, 1.6325, 1.6135, 1.6115, 1.6055, 1.615, 1.5935,
1.573, 1.579, 1.586, 1.585, 1.611, 1.6365, 1.643, 1.6465, 1.656,
1.6545, 1.6555, 1.6545, 1.6595, 1.6575, 1.6615, 1.6587, 1.63,
1.628, 1.633, 1.6365, 1.6285, 1.614, 1.6195, 1.6335, 1.6455,
1.646, 1.643, 1.6475, 1.6355, 1.672, 1.6625, 1.668, 1.665, 1.661,
1.6665, 1.662, 1.6615, 1.6645, 1.654, 1.6335, 1.6375, 1.6305,
1.6265, 1.6425, 1.6315, 1.629, 1.618, 1.6085, 1.596, 1.6105,
1.5965, 1.611, 1.617, 1.6065, 1.6035, 1.6035, 1.578, 1.5925,
1.606, 1.6147, 1.5995, 1.595, 1.6035, 1.606, 1.582, 1.567, 1.5805,
1.5855, 1.5815, 1.5845, 1.5815, 1.5715, 1.5775, 1.5795, 1.5825,
1.6055, 1.6084, 1.6135, 1.616, 1.602, 1.6165, 1.624, 1.624, 1.6145,
1.6255, 1.6378, 1.63, 1.6315, 1.607, 1.5868, 1.5895, 1.5927,
1.5948, 1.6004, 1.626, 1.6195, 1.6225, 1.637, 1.629, 1.6235,
1.628, 1.6375, 1.6605, 1.6568, 1.681, 1.6895, 1.6955, 1.6925,
1.7095, 1.7032, 1.6987, 1.692, 1.704, 1.6976, 1.6965, 1.696,
1.698, 1.7091, 1.707, 1.721, 1.7286, 1.7204, 1.7165, 1.7241,
1.7205, 1.7037, 1.7053, 1.6975, 1.7075, 1.72, 1.7245, 1.7243,
1.7185, 1.7385, 1.7402, 1.712, 1.7057, 1.71, 1.712, 1.6975, 1.7,
1.7115, 1.721, 1.7158, 1.7132, 1.6904, 1.6965, 1.6782, 1.6865,
1.6767, 1.686, 1.679, 1.6868, 1.6665, 1.6645, 1.6738, 1.677,
1.658, 1.6445, 1.623, 1.611, 1.6075, 1.6177, 1.5985, 1.5935,
1.612, 1.6085, 1.5935, 1.6047, 1.6092, 1.608, 1.6187, 1.6325,
1.6443, 1.645, 1.6295, 1.6178, 1.6133, 1.6335, 1.6265, 1.623,
1.6255, 1.6221, 1.6215, 1.601, 1.604, 1.5935, 1.604, 1.6145,
1.6137, 1.6285, 1.6377, 1.647, 1.663, 1.676, 1.673, 1.682, 1.6794,
1.6788, 1.6774, 1.694, 1.6965, 1.6937, 1.6957, 1.691, 1.6842,
1.696, 1.6925, 1.691, 1.6908, 1.6865, 1.7023, 1.706, 1.7095,
1.7145, 1.7032, 1.7005, 1.7027, 1.7082, 1.7118, 1.707, 1.7148,
1.7165, 1.7211, 1.7208, 1.7062, 1.7045, 1.704, 1.7055, 1.6985,
1.706, 1.7125, 1.7163, 1.7078, 1.705, 1.7125, 1.7077, 1.701,
1.6935, 1.6965, 1.7019, 1.7008, 1.7175, 1.735, 1.7365, 1.7371,
1.7398, 1.7399, 1.7397, 1.7333, 1.7308, 1.7398, 1.7366, 1.752,
1.7505, 1.7553, 1.7487, 1.744, 1.7358, 1.7474, 1.7504, 1.7528,
1.748, 1.7441, 1.7273, 1.7444, 1.727, 1.7343, 1.7314, 1.736,
1.763, 1.7658, 1.7603, 1.7534, 1.7517, 1.7438, 1.7255, 1.7219,
1.734, 1.718, 1.7275, 1.7269, 1.7279, 1.7306, 1.7055, 1.7069,
1.709, 1.7037, 1.7088, 1.7198, 1.7184, 1.7155, 1.707, 1.6893,
1.6779, 1.6898, 1.6963, 1.691, 1.68, 1.6961, 1.6979, 1.6885,
1.685, 1.6726, 1.668, 1.6728, 1.6675, 1.6788, 1.6695, 1.6952,
1.6985, 1.7071, 1.7151, 1.7181, 1.7134, 1.708, 1.7188, 1.7135,
1.7088, 1.7124, 1.7202, 1.701, 1.694, 1.6882, 1.6947, 1.6794,
1.6801, 1.6727, 1.6697, 1.657, 1.6501, 1.6461, 1.662, 1.6682,
1.6661, 1.6579, 1.6705, 1.6735, 1.6708, 1.6671, 1.674, 1.6683,
1.6596, 1.6551, 1.6463, 1.6456, 1.6478, 1.6447, 1.6438, 1.6444,
1.6466, 1.6435, 1.6428, 1.6515, 1.6665, 1.6692, 1.6695, 1.6698,
1.6721, 1.6672, 1.65, 1.6443, 1.6354, 1.6319, 1.6299, 1.5986,
1.6009, 1.6006, 1.6035, 1.5972, 1.5758, 1.5849, 1.5825, 1.5915,
1.5946, 1.5965, 1.5826, 1.5685, 1.5745, 1.5741, 1.54, 1.5235,
1.5383, 1.5457, 1.5558, 1.5428, 1.5569, 1.5662, 1.576, 1.5955,
1.5849, 1.5865, 1.576, 1.5795, 1.5888, 1.5743, 1.5814, 1.5792,
1.581, 1.5822, 1.5811, 1.582, 1.5745, 1.5872, 1.5557, 1.5533,
1.5552, 1.5603, 1.5456, 1.5396, 1.5309, 1.5377, 1.5411, 1.5462,
1.5615, 1.5831, 1.5805, 1.5783, 1.577, 1.5602, 1.5537, 1.5426,
1.5486, 1.5562, 1.5419, 1.5435, 1.5493, 1.5374, 1.5467, 1.5376,
1.5528, 1.5508, 1.5449, 1.5488, 1.5443, 1.5551, 1.547, 1.5467,
1.5461, 1.5515, 1.5573, 1.5519, 1.5426, 1.5444, 1.5411, 1.55,
1.5466, 1.5421, 1.5423, 1.5201, 1.5036, 1.5003, 1.5009, 1.5016,
1.4954, 1.497, 1.492, 1.4953, 1.4972, 1.5094, 1.5077, 1.4994,
1.4945, 1.5146, 1.5235, 1.5172, 1.5097, 1.53, 1.5348, 1.528,
1.5453, 1.5454, 1.551, 1.548, 1.5539, 1.5594, 1.5536, 1.5537,
1.5582, 1.5589, 1.5643, 1.5612, 1.5703, 1.5722, 1.5778, 1.5741,
1.5725, 1.571, 1.5777, 1.5773, 1.5728, 1.5728, 1.5691, 1.5718,
1.5714, 1.5738, 1.572, 1.5703, 1.5805, 1.5783, 1.5768, 1.5737,
1.5507, 1.55, 1.5539, 1.559, 1.5535, 1.5575, 1.5539, 1.5341,
1.5354, 1.5295, 1.5327, 1.5282, 1.532, 1.53, 1.5303, 1.5087,
1.5095, 1.5127, 1.5183, 1.5147, 1.5119, 1.5099, 1.5148, 1.5228,
1.52, 1.525, 1.5309, 1.5355, 1.5312, 1.5291, 1.5241, 1.5184,
1.5137, 1.5084, 1.4914, 1.4887, 1.4729, 1.4796, 1.4679, 1.4727,
1.4749, 1.458, 1.4644, 1.465, 1.4601, 1.4329, 1.4028, 1.3926,
1.3855, 1.3904, 1.4145, 1.4053, 1.4136, 1.3926, 1.3882, 1.3865,
1.3973, 1.4125, 1.4061, 1.4015, 1.4128, 1.4087, 1.3997, 1.3773,
1.4107, 1.3685, 1.3723, 1.3854, 1.3835, 1.3763, 1.3811, 1.4055,
1.401, 1.4048, 1.3892, 1.39, 1.3715, 1.3677, 1.3542, 1.3704,
1.3766, 1.3699, 1.365, 1.3811, 1.3734, 1.3823, 1.3902, 1.3753,
1.3746, 1.3697, 1.3711, 1.3646, 1.3701, 1.3906, 1.4135, 1.4433,
1.4466, 1.4414, 1.4368, 1.4597, 1.4404, 1.4482, 1.4362, 1.439,
1.4043, 1.3829, 1.3886, 1.3899, 1.413, 1.4233, 1.406, 1.4074,
1.4188, 1.4074, 1.4198, 1.3973, 1.4029, 1.4044, 1.3974, 1.4106,
1.4007, 1.3991, 1.3924, 1.3921, 1.3845, 1.3877, 1.3942, 1.3846,
1.3884, 1.3891, 1.3841, 1.3782, 1.3817, 1.3833, 1.3816, 1.3935,
1.3988, 1.402, 1.4042, 1.3923, 1.391, 1.3963, 1.3883, 1.3887,
1.3767, 1.3865, 1.3837, 1.393, 1.3849, 1.3863, 1.3792, 1.3807,
1.3805, 1.3967, 1.3915, 1.3928, 1.4048, 1.4067, 1.4073, 1.423,
1.4334, 1.4341, 1.4749, 1.4756, 1.4771, 1.4702, 1.4723, 1.4852,
1.4791, 1.4803, 1.4786, 1.4615, 1.4714, 1.4758, 1.4695, 1.4633,
1.4647, 1.4631, 1.479, 1.475, 1.481, 1.4717, 1.4714, 1.4908,
1.4895, 1.4875, 1.4873, 1.4876, 1.4675, 1.44, 1.4175, 1.4278,
1.4413, 1.4268, 1.4212, 1.423, 1.4299, 1.4393, 1.4363, 1.4301,
1.427, 1.4119, 1.4176, 1.4249, 1.4223, 1.4291, 1.4195, 1.4168,
1.4235, 1.4141, 1.3979, 1.3851, 1.387, 1.3936, 1.4017, 1.4006,
1.4053, 1.4083, 1.4164, 1.4191, 1.4155, 1.4134, 1.4167, 1.4166,
1.4161, 1.4123, 1.4195, 1.4145, 1.4024, 1.4095, 1.4048, 1.4125,
1.4079, 1.4085, 1.4136, 1.4165, 1.4358, 1.4338, 1.4368, 1.4453,
1.4451, 1.4381, 1.4363, 1.4432, 1.4416, 1.448, 1.4442, 1.4485,
1.4499, 1.4418, 1.4426, 1.4318, 1.4355, 1.4434, 1.4402, 1.4402,
1.4333, 1.4313, 1.4319, 1.4313, 1.4347, 1.4403, 1.4565, 1.4375,
1.4403, 1.4432, 1.4383, 1.437, 1.4407, 1.4466, 1.4576, 1.4646,
1.4696, 1.479, 1.4755, 1.4773, 1.4803, 1.4763, 1.4912, 1.4859,
1.4899, 1.4879, 1.4933, 1.4872, 1.4693, 1.4718, 1.4773, 1.4762,
1.4774, 1.4725, 1.4782, 1.4692, 1.4713, 1.4617, 1.443, 1.4533,
1.4513, 1.4516, 1.4513, 1.4471, 1.4528, 1.4614, 1.4697, 1.4759,
1.4758, 1.4789, 1.475, 1.4789, 1.4836, 1.4823, 1.4805, 1.4718,
1.4709, 1.476, 1.4742, 1.4762, 1.4775, 1.4763, 1.4753, 1.4777,
1.4758, 1.4875, 1.4781, 1.4764, 1.4832, 1.4818, 1.4792, 1.4805,
1.4826, 1.4778, 1.4918, 1.4997, 1.5013, 1.5037, 1.5104, 1.5096,
1.5073, 1.5121, 1.5057, 1.5164, 1.518, 1.5219, 1.5295, 1.5288,
1.5213, 1.5336, 1.5336, 1.5328, 1.5273, 1.5266, 1.5213, 1.5183,
1.5168, 1.5249, 1.5336, 1.5368, 1.5341, 1.5368, 1.5262, 1.5347,
1.5415, 1.5387, 1.5405, 1.5414, 1.5414, 1.5483, 1.5453, 1.5323,
1.5275, 1.5265, 1.5318, 1.5293, 1.5301, 1.5345, 1.536, 1.5363,
1.5363, 1.5353, 1.5229, 1.5177, 1.5148, 1.5207, 1.5244, 1.5289,
1.5315, 1.5322, 1.5287, 1.5218, 1.5222, 1.5235, 1.527, 1.5252,
1.5235, 1.528, 1.5278, 1.5233, 1.5246, 1.5217, 1.5226, 1.5184,
1.4922, 1.4865, 1.4917, 1.4885, 1.4863, 1.4897, 1.4877, 1.4784,
1.4809, 1.4808, 1.4774, 1.4728, 1.4736, 1.4779, 1.4813, 1.4843,
1.4829, 1.4845, 1.4784, 1.4753, 1.4767, 1.4834, 1.4856, 1.4935,
1.4882, 1.4893, 1.4817, 1.4959, 1.4874, 1.4783, 1.4777, 1.476,
1.4802, 1.4778, 1.4869, 1.4844, 1.4823, 1.4848, 1.4885, 1.4918,
1.508, 1.5098, 1.5122, 1.5124, 1.5095, 1.5143, 1.5084, 1.514,
1.5149, 1.5134, 1.5132, 1.5102, 1.5217, 1.5243, 1.5253, 1.5258,
1.527, 1.5306, 1.5296, 1.5304, 1.5272, 1.5285, 1.5298, 1.5315,
1.5293, 1.5405, 1.5375, 1.5437, 1.543, 1.5362, 1.535, 1.5234,
1.5227, 1.5234, 1.5203, 1.5103, 1.5073, 1.5132, 1.5165, 1.5132,
1.5168, 1.5164, 1.5078, 1.5059, 1.499, 1.4991, 1.5068, 1.5093,
1.5083, 1.5017, 1.5028, 1.4977, 1.499, 1.5023, 1.5192, 1.5276,
1.5261, 1.5316, 1.5371, 1.5424, 1.5665, 1.5627, 1.5547, 1.5404,
1.5566, 1.5539, 1.5412, 1.5439, 1.5466, 1.5534, 1.5454, 1.5544,
1.5601, 1.5539, 1.5536, 1.5553, 1.5564, 1.5552, 1.5567, 1.5411,
1.5418, 1.5575, 1.5649, 1.5628, 1.5714, 1.5757, 1.5841, 1.5895,
1.594, 1.5895, 1.5925, 1.6113, 1.624, 1.6244, 1.6407, 1.639,
1.6268, 1.6376, 1.6511, 1.6436, 1.6394, 1.6377, 1.6429, 1.6415,
1.6484, 1.6501, 1.6722, 1.6565, 1.6721, 1.6832, 1.6871, 1.6862,
1.6995, 1.6914, 1.694, 1.6896, 1.6831, 1.6697, 1.6758, 1.689,
1.6897, 1.6882, 1.6934, 1.7094, 1.7113, 1.7185, 1.7189, 1.7032,
1.7055, 1.7014, 1.7012, 1.6993, 1.6901, 1.6782, 1.6815, 1.6867,
1.6834, 1.6882, 1.6907, 1.6922, 1.6775, 1.6762, 1.6684, 1.6697,
1.6703, 1.6683, 1.6758, 1.711, 1.711, 1.7197, 1.7169, 1.7241,
1.7233, 1.7339, 1.7286, 1.7257, 1.7162, 1.7023, 1.7112, 1.7124,
1.717, 1.7235, 1.7273, 1.7248, 1.7317, 1.7186, 1.7285, 1.732,
1.7231, 1.7194, 1.7075, 1.6934, 1.7004, 1.6972, 1.7006, 1.6983,
1.6941, 1.7072, 1.6949, 1.695, 1.6933, 1.6907, 1.6911, 1.7012,
1.6968, 1.6967, 1.7056, 1.7262, 1.7261, 1.7294, 1.7289, 1.7289,
1.7085, 1.7167, 1.7148, 1.724, 1.7378, 1.7295, 1.7338, 1.727,
1.7247, 1.7321, 1.7224, 1.724, 1.7235, 1.7286, 1.7363, 1.7426,
1.7401, 1.7511, 1.749, 1.7539, 1.7448, 1.7572, 1.7619, 1.7512,
1.7696, 1.7909, 1.8003, 1.7974, 1.7922, 1.7907, 1.7964, 1.8127,
1.8273, 1.8306, 1.8372, 1.8445, 1.8291, 1.8377, 1.8368, 1.8567,
1.8639, 1.879, 1.8745, 1.8733, 1.8531, 1.8544, 1.8624, 1.8316,
1.8461, 1.8183, 1.8223, 1.8364, 1.8568, 1.842, 1.8173, 1.8202,
1.8005, 1.8104, 1.7964, 1.8002, 1.8114, 1.8328, 1.8184, 1.8182,
1.8068, 1.8103, 1.8111, 1.8015, 1.7915, 1.7699, 1.7632, 1.7681,
1.7686, 1.7708, 1.7713, 1.793, 1.7954, 1.7717, 1.7678, 1.7647,
1.7589, 1.7662, 1.7756, 1.7671, 1.7625, 1.7622, 1.7539, 1.754,
1.739, 1.7499, 1.7506, 1.7564, 1.7511, 1.7443, 1.7687, 1.7714,
1.7851, 1.7815, 1.7747, 1.7783, 1.7599, 1.7248, 1.7416, 1.7231,
1.7211, 1.7362, 1.721, 1.7232, 1.7209, 1.7055, 1.7116, 1.7113,
1.7238, 1.7233, 1.7308, 1.7336, 1.7252, 1.7327, 1.7314, 1.748,
1.7353, 1.7437, 1.7593, 1.7642, 1.7639, 1.7774, 1.7746, 1.7684,
1.7704, 1.7828, 1.7884, 1.7946, 1.783, 1.7733, 1.7732, 1.7702,
1.7846, 1.7718, 1.7725, 1.7688, 1.7804, 1.7733, 1.7724, 1.7724,
1.7836, 1.7915, 1.7981, 1.8037, 1.8185, 1.8226, 1.8257, 1.8166,
1.8203, 1.8185, 1.8213, 1.8228, 1.8312, 1.8271, 1.8367, 1.8408,
1.8273, 1.8025, 1.7805, 1.7891, 1.7891, 1.8054, 1.8233, 1.828,
1.8223, 1.819, 1.8082, 1.7888, 1.7934, 1.8138, 1.8087, 1.8205,
1.8097, 1.8243, 1.8186, 1.8248, 1.8196, 1.8243, 1.8218, 1.7988,
1.8019, 1.8117, 1.8131, 1.8148, 1.8122, 1.8089, 1.8187, 1.829,
1.8322, 1.827, 1.8312, 1.8366, 1.8278, 1.8167, 1.8208, 1.8138,
1.826, 1.8273, 1.8343, 1.8282, 1.8295, 1.8266, 1.8233, 1.8279,
1.8446, 1.8494, 1.8497, 1.849, 1.8473, 1.8427, 1.8388, 1.8244,
1.8176, 1.8176, 1.823, 1.8037, 1.797, 1.8076, 1.8075, 1.8024,
1.7904, 1.7917, 1.7987, 1.7953, 1.7896, 1.7951, 1.7938, 1.7945,
1.7793, 1.7815, 1.7728, 1.7648, 1.7638, 1.7688, 1.7765, 1.7747,
1.7778, 1.7779, 1.7814, 1.7892, 1.7845, 1.77, 1.7575, 1.7574,
1.7672, 1.7721, 1.7816, 1.778, 1.7828, 1.7803, 1.7818, 1.7719,
1.7637, 1.7731, 1.7775, 1.7796, 1.7966, 1.8041, 1.8044, 1.8132,
1.798, 1.79, 1.7899, 1.7829, 1.7944, 1.8009, 1.8015, 1.7955,
1.8098, 1.8133, 1.805, 1.8185, 1.8221, 1.8185, 1.808, 1.8122,
1.8179, 1.8292, 1.8183, 1.8036, 1.7988, 1.803, 1.792, 1.7881,
1.7785, 1.7876, 1.7907, 1.7926, 1.7788, 1.7824, 1.7754, 1.7736,
1.7746, 1.7786, 1.7844, 1.7832, 1.7719, 1.7682, 1.7727, 1.7796,
1.7813, 1.7747, 1.7844, 1.7969, 1.7938, 1.7973, 1.8004, 1.7995,
1.8023, 1.7964, 1.7993, 1.8076, 1.8076, 1.7764, 1.7635, 1.7493,
1.7508, 1.7244, 1.7346, 1.725, 1.7291, 1.7242, 1.692, 1.6878,
1.7031, 1.687, 1.6918, 1.681, 1.6915, 1.6826, 1.6849, 1.6873,
1.6788, 1.6711, 1.6806, 1.678, 1.6714, 1.6502, 1.6366, 1.6348,
1.6389, 1.6134, 1.6084, 1.6339, 1.6493, 1.6374, 1.6445, 1.624,
1.6232, 1.6288, 1.6421, 1.6482, 1.639, 1.6353, 1.6449, 1.6583,
1.6572, 1.6505, 1.6562, 1.6507, 1.6588, 1.6693, 1.6581, 1.6623,
1.6875, 1.684, 1.6783, 1.6927, 1.6892, 1.6668, 1.6694, 1.6676,
1.68, 1.6887, 1.7044, 1.7045, 1.7047, 1.7036, 1.7084, 1.6908,
1.678, 1.673, 1.6741, 1.6755, 1.6764, 1.671, 1.6679, 1.6595,
1.6536, 1.6523, 1.6591, 1.6672, 1.6645, 1.6643, 1.6732, 1.6753,
1.6742, 1.6803, 1.679, 1.6722, 1.672, 1.6656, 1.6576, 1.6598,
1.6688, 1.6759, 1.693, 1.6957, 1.6945, 1.6712, 1.6716, 1.6875,
1.6865, 1.6852, 1.6904, 1.6885, 1.6887, 1.6916, 1.6899, 1.7003,
1.713, 1.7222, 1.7302, 1.7225, 1.7238, 1.7324, 1.7329, 1.7387,
1.7308, 1.7276, 1.7312, 1.7342, 1.7406, 1.7494, 1.7412, 1.7429,
1.7627, 1.7729, 1.7812, 1.7856, 1.7698, 1.7817, 1.7889, 1.7899,
1.7915, 1.8061, 1.8026, 1.7972, 1.7964, 1.7854, 1.8057, 1.7872,
1.7871, 1.793, 1.7768, 1.7803, 1.7902, 1.7936, 1.7948, 1.7909,
1.7989, 1.8221, 1.825, 1.8174, 1.8116, 1.809, 1.8131, 1.8242,
1.8175, 1.8117, 1.8053, 1.8149, 1.8031, 1.8126, 1.8091, 1.8232,
1.827, 1.8429, 1.8354, 1.8439, 1.8458, 1.8373, 1.8447, 1.8367,
1.8394, 1.8467, 1.8487, 1.8508, 1.8437, 1.8316, 1.8146, 1.813,
1.8105, 1.8235, 1.8324, 1.8404, 1.8279, 1.8322, 1.834, 1.8352,
1.8408, 1.8529, 1.8499, 1.8435, 1.8667, 1.8701, 1.8705, 1.8755,
1.869, 1.8882, 1.8892, 1.8981, 1.8995, 1.8759, 1.8752, 1.8646,
1.864, 1.8746, 1.8778, 1.8961, 1.8958, 1.8833, 1.8956, 1.8978,
1.8969, 1.8905, 1.8688, 1.8856, 1.892, 1.8966, 1.9088, 1.9138,
1.9118, 1.9082, 1.913, 1.9214, 1.9195, 1.9291, 1.9214, 1.9162,
1.9089, 1.9141, 1.9224, 1.8788, 1.8626, 1.8642, 1.8686, 1.8353,
1.8405, 1.8428, 1.8254, 1.8275, 1.8344, 1.8341, 1.8172, 1.8108,
1.8141, 1.8279, 1.8225, 1.8349, 1.8373, 1.8508, 1.8506, 1.8615,
1.8561, 1.8405, 1.8369, 1.8487, 1.8586, 1.8707, 1.8758, 1.8708,
1.8721, 1.8517, 1.8462, 1.8263, 1.8446, 1.849, 1.849, 1.8452,
1.8517, 1.8678, 1.8828, 1.8752, 1.8815, 1.8804, 1.88, 1.8788,
1.8671, 1.8622, 1.875, 1.8686, 1.8727, 1.8628, 1.8438, 1.8366,
1.8282, 1.828, 1.8311, 1.8268, 1.8223, 1.8404, 1.8383, 1.823,
1.8174, 1.8141, 1.797, 1.803, 1.8116, 1.8149, 1.8095, 1.8293,
1.8319, 1.8472, 1.8577, 1.8577, 1.8609, 1.8641, 1.8641, 1.8662,
1.8726, 1.8786, 1.886, 1.8799, 1.8744, 1.8796, 1.8954, 1.8977,
1.8975, 1.8819, 1.8958, 1.9003, 1.8938, 1.9002, 1.9182, 1.9184,
1.9333, 1.9433, 1.9424, 1.9406, 1.9491, 1.9532, 1.9126, 1.9124,
1.9088, 1.9217, 1.9244, 1.9334, 1.945, 1.9489, 1.9212, 1.9375,
1.9395, 1.9386, 1.9403, 1.9261, 1.9326, 1.9417, 1.9468, 1.9513,
1.9265, 1.8985, 1.8921, 1.8899, 1.9009, 1.9055, 1.8993, 1.904,
1.9042, 1.932, 1.9397, 1.9349, 1.9367, 1.9373, 1.9423, 1.9514,
1.9433, 1.9535, 1.9789, 1.996, 1.9991, 2.0104, 2.0119, 1.9873,
1.9963, 1.9994, 1.9828, 1.9759, 1.9848, 1.9843, 1.9957, 1.9886,
1.9883, 1.9836, 1.9854, 1.9815, 1.9422, 1.9485, 1.9636, 1.9983,
2.0228, 2.0315, 2.0203, 2.0241, 2.0336, 2.0347, 2.0428, 2.0434,
2.0184, 2.0279, 2.0231, 2.0314, 2.0185, 2.0097, 2.0197, 2.0174,
2.0137, 2.0342, 2.0156, 2.0131, 2.0152, 2.0223, 2.0517, 2.0467,
2.044, 2.0451, 2.0488, 2.0254, 2.0394, 2.0403, 2.038, 2.0313,
2.0419, 2.0469, 2.0456, 2.0482, 2.0605, 2.0795, 2.0818, 2.0818,
2.0815, 2.109, 2.1178, 2.1455, 2.1464, 2.1531, 2.1543, 2.1936,
2.1923, 2.1908, 2.1884, 2.1675, 2.1464, 2.1644, 2.1571, 2.1344,
2.1609, 2.1952, 2.1886, 2.1908, 2.1637, 2.1522, 2.1554, 2.1567,
2.1124, 2.1083, 2.0975, 2.109, 2.1007, 2.0716, 2.0708, 2.0397,
2.0435, 2.0514, 2.0568, 2.0505, 2.036, 2.0396, 2.0532, 2.0357,
2.0368, 2.0472, 2.0672, 2.0819, 2.0886, 2.0873, 2.0734, 2.0677,
2.0534, 2.0404, 2.0554, 2.0591, 2.0448, 2.0465, 2.0605, 2.053,
2.0568, 2.0711, 2.0915, 2.0869, 2.0923, 2.098, 2.1162, 2.1157,
2.0976, 2.0962, 2.078, 2.0758, 2.0825, 2.1097, 2.1108, 2.1132,
2.1403, 2.1627, 2.1526, 2.1532, 2.1738, 2.1789, 2.152, 2.1616,
2.1635, 2.1418, 2.1453, 2.1385, 2.1521, 2.1642, 2.1776, 2.188,
2.1665, 2.1614, 2.1751, 2.182, 2.1892, 2.1999, 2.1733, 2.1739,
2.2071, 2.2274, 2.2455, 2.2574, 2.2695, 2.2724, 2.2623, 2.2706,
2.2662, 2.2892, 2.2913, 2.3078, 2.2932, 2.2183, 2.2398, 2.2223,
2.2194, 2.2152, 2.2164, 2.2184, 2.2318, 2.2409, 2.2495, 2.249,
2.2507, 2.2528, 2.2381, 2.2678, 2.2757, 2.3048, 2.3014, 2.3075,
2.3295, 2.3352, 2.3397, 2.3363, 2.3603, 2.3594, 2.3209, 2.3147,
2.3075, 2.2806, 2.274, 2.2648, 2.2711, 2.2724, 2.2841, 2.2772,
2.2651, 2.274, 2.2794, 2.2758, 2.2894, 2.2938, 2.304, 2.313,
2.3194, 2.3226, 2.3289, 2.304, 2.2877, 2.2741, 2.2468, 2.2405,
2.1992, 2.2101, 2.2111, 2.1982, 2.2024, 2.2279, 2.2298, 2.2339,
2.204, 2.1793, 2.1835, 2.195, 2.1569, 2.1398, 2.118, 2.1057,
2.1018, 2.1128, 2.0833)
And even shorter:
v <- na.omit(v)
Try this:
new.v <- v[ !is.na( v ) ]
Either is.na or na.omit are good enough for this situation
x <- c(1,NA,2,NA, 3) # a vector with NA
x[!is.na(x)] # a vector without NA
[1] 1 2 3
as.numeric(na.omit(x))
[1] 1 2 3
Actually as.numeric applied to na.omit is not necessary as you can tell from Dirk's answer :)

Resources