New answers tagged

2

Based on assuming the other answers are correct (since you appear to be unwilling or unable to clarify what correct output is), the following produces the same result but is vastly faster (orders of magnitude) for large lists: Join @@ (GatherBy[MasterPositionsList~Join~list, N@#[[3 ;; 6]] &][[;; Length@MasterPositionsList, 2 ;;]]) Depending on the ...


2

sortedlist = SortBy[list, Position[N@MasterPositionsList[[All, 3 ;; 6]], N@#[[3 ;; 6]]] &]; Note the use of N@ to numericalize the key columns (columns 3 to 5) in both MasterPositionsList and list. Alternatively, using @Jack's approach in a slightly different way: masPosInList = Flatten[Map[Position[N@list[[All, 3 ;; 6]], N@#] &, ...


2

Updated to handle OP's MWE. Another approach is to iterate through the master list and locate the positions in the randomly ordered list where positions 3 through 6 occur. I will use the OP example data (see question) for MasterPositionList and list (i.e, the random order list). Locate the rows in the MasterPositionsList where columns three through six ...



Top 50 recent answers are included