0
$\begingroup$

I have the following list:

    list={{55.1958, -0.349675}, {55.8649, -0.317977}, {55.9733, -0.31084},
{56.3041, -0.286584}, {56.3297, -0.284539}, {56.7858, -0.243529},
{56.9002, -0.232266}, {58.1689, -0.0329478}, {58.1721, -0.0322038},
{59.6201, 0.490692}, {59.9231, 0.634417}, {60.1028, 
  0.71699}, {61.5448, 0.627379}, {61.8061, 0.4619}, {61.9406, 
  0.379888}, {63.7961, 0.00405673}, {63.8918, 0.00285513}, {64.2303, 
  0.0018482}, {64.4817, 0.0026852}, {64.5854, 0.00286071}, {64.9619, 
  0.0026916}, {65.2636, 0.00266422}, {65.4107, 0.00303601}, {65.8283, 
  0.0047811}, {65.8594, 0.00496729}, {66.1707, 0.00693903}, {66.3076, 
  0.00784256}, {66.3826, 0.00832286}, {66.5637, 0.00923505}, {66.8723,
   0.0110684}, {67.0349, 0.0122277}, {67.2602, 0.0143215}, {67.3616, 
  0.0154748}, {67.5422, 0.0175274}, {67.5623, 0.0177623}, {67.7695, 
  0.0204659}, {67.8752, 0.02194}, {68.0342, 0.0241818}, {68.1368, 
  0.0256453}, {68.303, 0.028032}, {68.3994, 0.0294309}, {68.8128, 
  0.0363789}, {68.8927, 0.0378617}, {70.0613, 0.0703509}, {70.0904, 
  0.0714557}, {70.5566, 0.0897313}, {70.7156, 0.0966578}, {71.0797, 
  0.113603}, {71.1489, 0.117293}, {72.54, 0.309317}, {72.7591, 
  0.368755}, {72.8663, 0.396925}, {73.4503, 0.306532}, {74.5514, 
  0.0450008}, {74.7037, 0.0411367}, {74.9505, 0.0353007}, {74.9568, 
  0.0351677}, {75.7922, 0.0215057}, {76.0215, 0.0189822}, {76.3928, 
  0.0157741}, {76.5846, 0.0147464}, {76.7665, 0.013607}, {76.9156, 
  0.0126136}, {77.3027, 0.0100844}, {77.394, 0.0096262}, {78.0759, 
  0.00653923}, {78.1815, 0.00610426}, {79.388, 0.00480405}, {79.7775, 
  0.00461144}, {80.4616, 0.0048199}, {80.5252, 0.00504478}, {81.0225, 
  0.00812861}, {81.2425, 0.00970376}, {81.9441, 0.014958}, {81.9524, 
  0.0150288}, {82.2023, 0.0175119}, {82.2312, 0.0178397}, {82.4584, 
  0.0204348}, {82.5091, 0.0210096}, {82.7284, 0.0233184}, {82.7436, 
  0.0234685}, {83.4903, 0.0337986}, {83.5689, 0.0349307}, {83.7846, 
  0.0379793}, {83.8085, 0.0383198}, {84.0496, 0.0418432}, {84.0723, 
  0.0421832}, {84.5827, 0.0516388}, {84.6306, 0.0527725}, {84.9036, 
  0.0589444}, {85.1689, 0.0635194}, {85.8994, 0.082384}, {85.9304, 
  0.0836593}, {86.4216, 0.10509}, {86.444, 0.106238}, {86.6771, 
  0.11893}, {86.7187, 0.121329}, {88.4615, 0.923822}, {88.776, 
  0.834447}, {89.3438, 0.0264924}}

I want to find the (x,y) data that is the maximum based on the first element. In particular, I want to find:

  1. The (x,y) data that is the maximum but lower than 60.791 based on the first element (answer would be: {60.1028, 0.71699})

2.The (x,y) data that is the maximum but lower than 73.127 based on the first element (answer would be: {72.8663, 0.396925})

  1. The (x,y) data that is the maximum but lower than 88.611 based on the first element (answer would be: {88.4615, 0.923822})
$\endgroup$
1
  • $\begingroup$ @flinty yes, you are right! I edited it. Thank you for the answer. That works great! I accepted it ! $\endgroup$
    – John
    Jun 19, 2020 at 21:29

1 Answer 1

3
$\begingroup$
First@MaximalBy[Select[list, #[[1]] < 60.791 &], First]
First@MaximalBy[Select[list, #[[1]] < 73.127 &], First]
First@MaximalBy[Select[list, #[[1]] < 88.611 &], First]

(* or as a function: *)
sel[data_, threshold_] := First@MaximalBy[Select[data, #[[1]] < threshold &], First]
sel[list, #] & /@ {60.791, 73.127, 88.611}

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.