r – Why quantile does not show different results?

I am trying to use this solution here

How to rank based on ecdf in r?

 dat[, .(quant = quants, val = ecdf(dist)(quantile(dist, quants))), by = rowval]

This gives different results for each rowval

However, when i apply it to my data, I always got the same output

example:

     ecdf(gg)(quantile(gg, quants))
     ecdf(ff)(quantile(ff, quants))

Why I am getting the same for both ff and gg?

tt= structure(c(7.9, 36.1, 57.7, 199.4, 175.5, 107, 62.7, 142.1, 76.6, 196.9, 134.4, 80.4, 73, 49.2, 66.6, 196.5, 126.7, 43.9, 34.9, 26.8, 86.5, 188, 120.2, 79.5, 21.8, 25.2, 95.1, 222.7, 109.9, 44, 51.2, 46.4, 79.6, 143, 83.1, 114.5, 63.6, 54.9, 52.2, 139.6, 122.1, 147.5, 74, 167.6, 167.8, 208.3, 141.3, 56.1, 40, 10.8, 64.9, 96.6, 108.6, 46.3, 60.7, 152.7, 122.5, 167.8, 115, 60.8, 44.8, 66.1, 70, 154, 106.4, 96.2, 24.8, 69, 87.2, 277.4, 110, 29.3, 23, 16.4, 61.7, 122.2, 123.1, 50.7, 125.2, 65.1, 124.5, 222.5, 114, 42.7, 25.4, 46.5, 32.1, 178.6, 90.7, 92.1, 100.2, 196.5, 143.7, 170.7, 205.9, 112.3, 43.5, 51.2, 110.9, 107.3, 104.1, 95.3, 63.5, 95.9, 129.8, 146.9, 96.4, 79.3, 32.4, 48, 81.3, 147, 87.7, 59.4, 87.8, 49.6, 83.5, 230.8, 115.9, 98.9, 29.2, 23.4, 115, 108.2, 110.5, 75.5, 77.9, 83.7, 102.8, 94.7, 114.3, 90.5, 26.7, 26.6, 40.2, 87.1, 64.8, 49.5, 55.3, 74.1, 94.9, 76, 132.8, 81.2, 38.7, 42.1, 78.7, 132.3, 126.7, 43.3, 73.9, 81.5, 154.7, 128.3, 180.7, 85.9, 51.5, 53.3, 97.5, 131.4 , 103.3, 59.9, 82.1, 71.9, 71.2, 167.9, 163.8, 52.7, 18, 27.1, 83, 178.9, 106, 103.8, 108.1, 113.3, 96.3, 153.4, 116.9, 97.6, 46, 67.7, 109.1, 107, 120.5 , 107.8, 98.9, 114.3, 82.6, 181, 107.7, 63.2, 86.6, 26.9, 64.6, 133.3, 78.9, 117.2, 23.8, 21.8, 90.5, 98.9, 114.9, 26.3, 9.2, 42, 58.9, 138.7, 151.9, 72.1 , 122, 113.6, 145.1, 200.1, 155, 127.9, 54.6, 96.4, 76.3, 141.2, 81.3, 121.4, 53.7, 101.7, 186.4, 217.4, 170.6, 112.2, 44.6, 88.8, 99.3, 121.4, 141.2, 109.5, 117.9 , 97.5, 156.8, 149.2, 115.8, 72.4, 36.3, 32.5, 106.7, 123.4, 105.7, 82.8, 74.9, 33.5, 109.1, 178.6, 119.9, 115.5, 20.4, 13.9, 92.3, 186.9, 125.2, 127.4, 72.2, 74 , 109.1, 157.8, 90.3, 88.7, 7.6, 30.5, 74.7, 153.5, 66.4, 163.7, 47.5, 93, 102.5, 174.7, 174.8, 72.6, 32, 53.5, 36.8, 173.4, 102.7, 54, 78.6, 54.8, 107 , 185.2, 163.5, 82.4, 33.5, 46.5, 80.6, 116.7, 136.1, 73.7, 60.5, 120.2, 99.3, 223.4, 132.2, 104.1), names = c(“”, “”, “”, “”, “”” , “”, “”,””, “”, “”, “”, “”, “”, “”, “”, “”, “”, “”, “”, ” “,””,””,””,””,””,””,””, “”,””,””,””,””,””,””,””,””,””,””,””,””,”””,””,””,””,””,””,””,”” , “”, “”,””, “”, “”, “”, “”, “”, “”, “”, “”, “”, “”, “”, ” “,””,””,””,””,””,””,””,””,””,””,””,””,””,””,””,””,””,””,”””,”, “”,””,””,””,””,””,””,””,””,””,””,””,””,”””,””,””,””,””,””,””,”” , “”, “”,””, “”, “”, “”, “”, “”, “”, “”, “”, “”, “”, “”, ” “,””,””,””,””,””,””,””,””,””,””,””,””,””,””,””,””,””,””,”””,”, “”,””,””,””,””,””,””,””,””,””,””,””,””,”””,””,””,””,””,””,””,”” , “”, “”,””, “”, “”, “”, “”, “”, “”, “”, “”, “”, “”, “”, ” “,””,””,””,””,””,””,””,””,””,””,””,””,””,””,””,””,””,””,”””,”, “”,””,””,””,””,””,””,””,””,””,””,””,””,”””,””,””,””,””,””,””,”” , “”, “”,””, “”, “”, “”, “”, “”, “”, “”, “”, “”, “”, “”, ” “,””,””,””,””,””,””,””,””,””,””,””,””,””,””,””,””,””,””,”””,”, “”,””,””,””,””,””,””,””,””,””,””,””,””,”””,””,””,””,””,””,””,”” , “”, “”,””, “”, “”, “”, “”, “”, “”, “”, “”, “”, “”, “”, ” “,””,””,””,””,””,””,””,””,””,””,””,””,””,””,””,””,””,””,”””,”, “”,””,””,””,””,””,””,””,””,””,””,””,””,”””,””,””,””,””,””,””,”” , “”, “”, “”, “”, “”, “”))

ps=c(81.437126976, 56.699371008, 96.938313408, 123.76198656, 89.666082432, 42.22448352, 46.2231576, 100.420019136, 107.58326688, 198.66817728, 168.97789728, 157.310252928, 55.259302464, 39.355763328, 88.46514144, 115.33034016, 69.731447616, 44.76207744, 29.35138032, 45.894625056, 113.56819488, 88.022294784, 148.24249344, 59.518815552, 66.208735584, 47.511346176, 53.17146288, 99.22627008, 75.691637568, 24.137269056, 50.95281024, 54.404571456, 102.26292768, 125.004195648, 97.86088224, 28.272574368, 28.724688288, 42.87758112, 53.551581408, 99.19101888, 56.519623584, 64.76140512, 41.599462464, 68.767839648, 139.45149216, 185.590567872, 126.61370496, 96.917823648, 94.205059776, 125.329873536, 90.065244384, 80.39106144, 67.544507232, 41.96702016, 57.767409792, 55.72290672, 93.68807328, 189.575036064, 88.40915424, 86.982593472, 103.011237216, 248.2546752, 160.0605144, 108.69272064, 91.256757408, 65.5331472, 40.96197648, 61.833569184, 118.03330368, 203.74910208, 97.59546144, 71.162061408, 60.3 59431392, 62.683020288, 154.51863696, 105.68511936, 79.030905984, 56.93976, 23.3008104384, 66.656510496, 97.46920512, 177.971403744, 110.43532224, 83.791253088, 50.881484448, 97.40845728, 61.016817888, 155.18138112, 112.137054912, 67.00081536, 37.959034752, 61.4110248, 120.06605376, 196.073557632, 136.42782048, 66.3680736, 110.727814752, 68.207553792, 62.257881312, 77.1472512, 79.213760352, 58.98645504, 54.26666064, 61.83930096, 146.50616448, 108.409231008, 124.82447328, 88.739088192, 69.307831872, 72.802291968, 57.706315488, 79.41429216, 85.239303264, 81.99055872, 80.446038624, 96.595772832, 109.517184, 162.953614944, 211.95084672, 199.951050528, 180.125158752, 87.8871168, 104.881778208, 103.52367648, 64.418707296, 61.37218368, 74.566843488, 53.425830528, 143.68046976, 139.239543456, 181.20467232, 119.055763872, 29.578562208, 90.420614496, 89.192139552, 123.42826656, 74.99332512, 47.23601184, 49.03641504, 47.951555904, 132.35547744, 249.430660416, 116.24402016, 109.364616288, 32.61902 832, 133.227206784, 103.177271232, 117.68356512, 81.932711328, 30.84796224, 49.936464576, 60.291025056, 91.383552, 201.119020416, 73.09305216, 130.732784352, 102.703274784, 47.877854976, 73.63510848, 100.60529184, 66.018997728, 52.10627616, 39.014618976, 88.181980992, 123.6336048, 107.892487296, 127.5099408, 82.329516288, 64.115592768, 93.745354752, 177.258627936, 158.1551568, 65.469898944, 70.4639088, 55.054137024, 64.842430176, 78.42362976, 182.902418496, 179.55623808, 65.63861136, 97.847415936, 94.554152928, 155.66284944, 169.04632608, 91.972479456, 33.8519088, 23.5673460576, 50.21290224, 89.41018464, 148.01333904, 107.24887296, 92.987325216, 94.834456992, 77.284706688, 90.292586976, 118.48319712, 84.01243536, 67.97722176, 26.934499296, 61.39723104, 98.69685408, 232.43128416, 169.58533248, 89.782539264, 95.726471328, 64.278652032, 95.643949824, 117.69043392, 88.22863872, 62.18819712, 50.209366752, 75.39039792, 118.9645056, 214.106582016, 194.44541184, 163.491571584, 97.298049312, 12 4.378111872, 81.794291616, 88.25547456, 89.43726672, 117.23193504, 39.393746496, 61.153871616, 167.35185792, 255.71649024, 243.53390016, 132.449129856, 39.83236128, 76.031529984, 56.5082136, 84.3127056, 112.809038688, 90.51792768, 82.481086944, 73.80491904, 101.58861888, 142.270661952, 210.95308224, 89.020534464, 116.7608304, 78.27152256, 126.68215968, 84.86526816, 106.76089008, 71.49140352, 43.60582512, 60.360181344, 154.63260288, 254.882757888, 161.26677504, 93.788943552, 30.555535392, 94.074172416, 103.14598752, 62.95555872, 57.794220576, 62.92238112, 37.519268256, 78.32927232, 90.79407936, 239.792973696, 223.96360032, 68.049117792, 133.516445472, 139.036649472, 172.266893856, 89.11881792, 77.12908128, 40.36161312, 78.339771648, 105.420163392, 121.01482944, 137.292453792, 239.45098176, 100.979322624, 79.050002976, 77.513692608, 150.26038272, 72.88895808, 55.453566816, 39.85194816, 50.243543136, 87.501828096, 182.38110336, 197.045495424, 233.51258016, 98.256005856, 53.23092336, 83.31 7756032, 140.280235776, 72.5784624, 68.70082608, 47.85179328, 47.432026656, 52.809932448, 86.78187072, 152.621178048, 109.64662848, 57.969575424 )

     gg=structure(c(47.91623, 128.9209, 136.9988, 225.3921, 261.9514, 
245.3399, 87.18586, 127.1519, 103.7799, 235.3285, 188.6513, 119.4504, 
127.4859, 126.312, 150.2479, 242.0646, 216.1981, 83.04191, 69.72716, 
33.11016, 130.323, 261.3274, 174.4785, 173.8004, 56.97673, 56.87663, 
148.394, 262.696, 196.6854, 94.45341, 84.06515, 76.94743, 90.87217, 
224.1363, 166.3885, 192.3533, 132.085, 123.7974, 113.982, 175.7438, 
217.7409, 207.4745, 114.4186, 183.0401, 164.3318, 221.009, 218.2109, 
128.489, 84.56771, 44.11597, 146.2127, 147.0343, 165.952, 99.1718, 
84.09065, 128.1349, 133.0132, 275.9096, 152.758, 102.1557, 114.1074, 
166.5217, 118.4781, 211.8301, 197.5859, 172.9627, 52.9639, 117.7168, 
144.1968, 250.4937, 152.9085, 74.45813, 72.68907, 53.91991, 115.3312, 
154.9957, 147.7459, 94.01306, 166.1848, 94.84205, 109.8599, 234.6222, 
153.293, 86.63279, 56.88255, 91.72418, 72.79073, 184.1113, 117.6926, 
156.613, 126.9655, 208.8138, 158.5517, 214.772, 229.627, 171.7557, 
106.5288, 88.71244, 190.312, 113.5542, 170.7096, 145.9808, 86.30895, 
110.9697, 128.1918, 214.6025, 144.1853, 129.0065, 85.51128, 114.4349, 
142.0498, 202.8718, 121.3254, 98.90034, 91.1917, 83.44194, 98.5509, 
225.8441, 135.5945, 136.1874, 64.43427, 51.38524, 165.5468, 147.1507, 
148.4345, 108.9438, 87.21472, 60.71865, 108.6508, 158.2541, 135.2272, 
115.8585, 70.04764, 58.17463, 77.55959, 129.7184, 130.6494, 76.40932, 
75.14351, 69.14993, 103.7932, 130.4946, 191.9752, 157.4966, 138.7099, 
75.13763, 144.1265, 205.2114, 208.147, 77.56853, 83.33479, 98.85249, 
169.5638, 121.5025, 205.1966, 132.4064, 70.50128, 102.8664, 145.3133, 
205.6875, 179.7965, 78.16802, 76.87644, 82.77924, 92.58449, 206.9436, 
176.1082, 78.27281, 42.80114, 50.12946, 110.7421, 218.2548, 158.9284, 
134.3917, 120.8917, 122.9613, 106.0963, 205.511, 117.902, 173.3386, 
130.5089, 109.7282, 167.407, 181.266, 255.1936, 150.1216, 105.0394, 
105.6428, 99.20322, 238.9366, 145.5005, 117.2579, 120.6576, 84.72058, 
121.1006, 160.392, 157.4808, 154.3849, 48.87724, 42.56045, 82.34991, 
166.9189, 186.7232, 55.13901, 62.07336, 97.53288, 134.042, 177.1058, 
197.8166, 113.1556, 103.1997, 143.1248, 132.7045, 206.2013, 215.2793, 
155.4867, 119.0518, 185.9246, 168.2462, 211.304, 123.3999, 185.2281, 
71.62428, 137.5074, 150.8047, 154.3091, 179.9585, 144.8171, 103.1798, 
111.2594, 117.7134, 146.9736, 191.2107, 177.8377, 102.3179, 112.336, 
166.6746, 178.5558, 150.6992, 109.7452, 54.10648, 89.50193, 136.0629, 
105.2122, 155.2998, 98.9437, 99.56956, 45.18689, 124.5834, 146.0052, 
133.8764, 144.008, 62.98795, 49.21946, 167.0605, 224.3771, 156.3118, 
130.5942, 86.20721, 62.83106, 78.73756, 177.0443, 108.1803, 108.3195, 
34.18321, 84.191, 152.9997, 229.758, 150.1599, 162.8334, 81.83665, 
108.9844, 120.4602, 282.2451, 150.1999, 122.7998, 97.88223, 70.90494, 
108.8432, 181.801, 199.18, 84.231, 129.1382, 58.73261, 132.556, 
182.9129, 164.7527, 141.4056, 96.56424, 92.08414, 115.8384, 144.6935, 
196.9319, 183.3567, 77.26698, 104.1256, 103.5664, 304.9384, 191.7989, 
119.7396), names = c("", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", ""))



     ff=structure(c(18.5, 80.0625, 75.8125, 126.25, 161.5625, 187.625, 
77.9375, 122.3125, 106.3125, 207.75, 130.5625, 65, 87.9375, 138.625, 
88.8125, 188.8125, 157.5, 102.9375, 77.4375, 37, 118.75, 222.375, 
165.125, 115.3125, 42.625, 49.3125, 68.9375, 169.625, 143.0625, 
106.5, 67.875, 93.0625, 102.1875, 157.625, 94.8125, 135.8125, 
45, 68.5625, 84.375, 101.375, 102.875, 119, 86.875, 114.8125, 
159.5625, 193, 139.3125, 55.1875, 25.125, 56.9375, 130.1875, 
124.125, 117.9375, 128.1875, 93.5, 125.25, 140.5, 184.5625, 128.8125, 
99.375, 76.5, 123.25, 74.9375, 217, 174.8125, 119.875, 74.4375, 
95, 106.25, 246.125, 143.6875, 72.5625, 89.0625, 68.6875, 93, 
163.3125, 136, 92.4375, 105.125, 124.1875, 198.9375, 232.375, 
140.4375, 89.375, 47.75, 96.6875, 68.75, 171.625, 154.375, 116.875, 
116.125, 173.9375, 140.625, 194.4375, 194.625, 109.75, 90.5625, 
74.9375, 159.8125, 132.1875, 158.3125, 119.5625, 78.25, 106.1875, 
178.3125, 188.6875, 153, 88.1875, 71.6875, 60.0625, 147.4375, 
145.8125, 97.5625, 103.9375, 80.25, 88.875, 87.75, 243.875, 164.3125, 
139.3125, 86.1875, 70.0625, 106.875, 189.75, 94.9375, 138.5, 
119.1875, 74.8125, 128.375, 73, 152.125, 81.25, 54.875, 61.8125, 
124, 135.75, 136.25, 99.0625, 100.625, 91.4375, 162.8125, 133.625, 
113.5, 99.625, 80.3125, 49.625, 86.375, 133.1875, 201.4375, 111.9375, 
119.3125, 92.25, 144.0625, 157.75, 143.1875, 78.3125, 44.0625, 
89.375, 145.6875, 104.0625, 147.875, 111.0625, 114.125, 125, 
131.9375, 227.375, 181, 73.625, 79.4375, 37.3125, 158.9375, 161.25, 
117.875, 195.125, 132.6875, 146.0625, 130.3125, 188.5625, 111.25, 
125.0625, 71.125, 130.6875, 147.3125, 69.5625, 155.1875, 170.625, 
66.1875, 102.125, 82.9375, 150.3125, 142.4375, 71.1875, 169.9375, 
85.6875, 133.625, 111.4375, 94.0625, 119.3125, 42.625, 42.3125, 
121.875, 180.8125, 198.625, 69, 68.875, 90, 151.625, 196.25, 
188.8125, 139.6875, 106, 155.625, 133.3125, 201.4375, 175.5625, 
185.6875, 85.0625, 79.3125, 123.9375, 130.25, 88, 121.875, 99.625, 
117.375, 153, 187.4375, 158, 67.1875, 110.8125, 60.75, 149.8125, 
120.3125, 209.375, 140.25, 106.9375, 112.375, 178.3125, 170.5, 
130.75, 126.875, 29, 69.75, 108.5625, 87.5, 122.5625, 101.4375, 
78.6875, 62.9375, 147.1875, 229.3125, 163.375, 133.25, 36.75, 
52, 129.375, 237.625, 154.5, 98.375, 86.375, 112.1875, 130.0625, 
193.6875, 78.3125, 83.5625, 9.3125, 93.4375, 162.4375, 110.5625, 
67.8125, 116.8125, 143.8125, 78.3125, 152.0625, 292.9375, 130.625, 
57.9375, 34.5625, 125.5, 85.125, 133.875, 172.625, 59.75, 118.0625, 
72.0625, 127.3125, 195.5625, 183.3125, 117.625, 295.875, 29.4375, 
42.8125, 155.0625, 170.25, 115.75, 108.75, 98.0625, 128.0625, 
199.6875, 197.3125, 70.375), names = c("", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", ""))

Leave a Comment