cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
%3CLINGO-SUB%20id%3D%22lingo-sub-384699%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3Eunir%20datos%20basados%20en%20la%20marca%20de%20tiempo%20aproximada%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-384699%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3ETengo%20dos%20tablas%20de%20datos%20a%20las%20que%20necesito%20unir.la%20tabla%20A%20tiene%20marcas%20de%20tiempo%20en%20horas%3A%2024%2C%2048%2C%2072%2C%2096%2C....la%20tabla%20B%20tiene%20datos%20en%20l%C3%ADnea%20con%20intervalos%20de%205%20minutos%2C%20por%20lo%20que%20la%20marca%20de%20tiempo%20debe%20tener%20varios%20decimales%20para%20capturar%20la%20precisi%C3%B3n%3A%201.000%2C%201.083%2C%201.167%2C%201.250%2C%201.333%2C%201.417%2C%201.500%2C%20etc.%20unir%20B%20con%20A%20funciona%20bien.%20Esto%20no%20es%20un%20problema%20porque%20siempre%20hay%20una%20coincidencia%20de%20n%C3%BAmeros%20enteros%20de%20la%20marca%20de%20tiempo%20en%20la%20tabla%20B%20con%20la%20tabla%20A.%20Por%20lo%20tanto%2C%20para%20todos%20los%20puntos%20de%20tiempo%20de%20A%20hay%20un%20valor%20correspondiente%20en%20B.%20El%20problema%20es%20que%20algunas%20veces%20la%20tabla%20A%20termina%20en%20%22120.1%22.%20o%20%22120%2C4%22%20horas%2C%20por%20ejemplo.%20Esto%20significa%20que%20la%20uni%C3%B3n%20falla%20y%20ning%C3%BAn%20dato%20de%20B%20se%20unir%C3%A1%20a%20A%20en%20el%20punto%20de%20datos%20final.%20%C2%BFHay%20alguna%20manera%20de%20obtener%20coincidencias%20%22aproximadas%22%20como%20funciona%20BUSCARV%20en%20Excel%3F%20No%20puedo%20redondear%20simplemente%20los%20valores%20de%20la%20tabla%20B%20porque%20entonces%20tengo%20valores%20que%20se%20repiten%20(en%20los%20intervalos%20de%200%2C3%20y%200%2C8).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-384699%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CLINGO-LABEL%3ECombinaci%C3%B3n%20y%20limpieza%20de%20datos%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-384743%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20unirse%20a%20datos%20basados%20en%20la%20marca%20de%20tiempo%20aproximada%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-384743%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EOtra%20idea%20que%20quiz%C3%A1s%20desee%20comprobar%20es%20utilizar%20JMP%20Query%20Builder%20para%20realizar%20uniones%20%22difusas%22.%3C%2FP%3E%0A%3CP%3EMir%C3%A9%20esto%20en%20busca%20de%20alguien%20que%20quisiera%20identificar%20componentes%20qu%C3%ADmicos%20que%20se%20encuentran%20dentro%20de%20un%20cierto%20rango%20de%20masa%20a%20partir%20de%20espectrometr%C3%ADa%20de%20masas.%3C%2FP%3E%0A%3CP%3EHe%20adjuntado%203%20tablas%20como%20ejemplo.%20La%20tabla%20unida%20tiene%20una%20clase%20de%20la%20tabla%20Ref%20donde%20la%20masa%20en%20la%20tabla%20de%20datos%20est%C3%A1%20dentro%20del%20rango%20de%20masa%20baja%20y%20masa%20alta.%3C%2FP%3E%0A%3CP%3EMe%20complace%20brindarle%20m%C3%A1s%20orientaci%C3%B3n%20si%20cree%20que%20esta%20soluci%C3%B3n%20ser%C3%ADa%20%C3%BAtil.%3C%2FP%3E%0A%3CP%3EAs%C3%AD%20es%20como%20se%20define%20la%20uni%C3%B3n%20difusa%20en%20JMP%20Query%20Builder%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202021-05-13%20121130.png%22%20style%3D%22width%3A%20765px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Screenshot%202021-05-13%20121130.png%22%20style%3D%22width%3A%20765px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Screenshot%202021-05-13%20121130.png%22%20style%3D%22width%3A%20765px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F32810i82EF64C99C04F884%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Screenshot%202021-05-13%20121130.png%22%20alt%3D%22Screenshot%202021-05-13%20121130.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-384710%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20unirse%20a%20datos%20basados%20en%20la%20marca%20de%20tiempo%20aproximada%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-384710%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EHOLA%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EConsulte%20la%20funci%C3%B3n%20Loc%20Sorted(%20).%20Se%20puede%20utilizar%20para%20realizar%20b%C3%BAsquedas.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPor%20ejemplo%2C%20el%20siguiente%20c%C3%B3digo%20asigna%20calificaciones%20con%20letras%20a%20puntuaciones%20de%20ex%C3%A1menes%20simulados.%20Es%20decir%2C%20utilizando%20una%20matriz%20de%20b%C3%BAsqueda%20%5B0%2C%2060%2C%2070%2C%2080%2C%2090%5D%2C%20a%20las%20puntuaciones%20de%20muestra%20de%2085%2C%2067%2C%2099%2C%2092%20y%2089%20se%20les%20asignan%20calificaciones%20con%20letras%20F%2C%20D%2C%20C%2C%20B%20y%20A%20dependiendo%20de%20si%20la%20puntuaci%C3%B3n%20excede%200.%20%2C%2060%2C%2070%2C%2080%20o%2090%2C%20respectivamente.%20Lo%20he%20usado%20de%20manera%20an%C3%A1loga%20a%20su%20caso%20de%20uso.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESalud%2C%3C%2FP%3E%0A%3CP%3EBrady%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3EWords(%20%22FDCBA%22%2C%20%22%22%20)%5BLoc%20Sorted(%20%5B0%2C%2060%2C%2070%2C%2080%2C%2090%5D%2C%20%5B85%2C%2067%2C%2099%2C%2092%2C%2089%5D%20)%5D%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22brady_brady_0-1620871449883.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22brady_brady_0-1620871449883.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22brady_brady_0-1620871449883.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F32807iD7DB04C360820AED%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22brady_brady_0-1620871449883.png%22%20alt%3D%22brady_brady_0-1620871449883.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
tatersalad
Level II

join data based on approximate time stamp

I have two data tables that i need to join.  table A has time stamps in hours: 24, 48, 72, 96,....  table B has online data with 5 minute intervals, so the time stamp must have several decimal places to capture the precision: 1.000, 1.083, 1.167, 1.250, 1.333, 1.417, 1.500 etc.  joining B to A works well. these is no problems because there is always a whole number match of time stamp in table B with table A. so for all of A's time points there is a corresponding value in B. the problem is that some times table A ends in "120.1" or "120.4" hours for example. This means that the join fails and no data from B will join to A at the final data point. is there a way to get "approximate" matches like the way VLOOKUP works in excel? I cannot simple round the values of table B because then i have repeating values (at the 0.3 and 0.8 intervals)

 

2 REPLIES 2

Re: join data based on approximate time stamp

HI,

 

Check out the Loc Sorted( ) function. It can be used to perform lookups.

 

For example, the code below assigns letter grades to simulated test scores. That is, using a lookup matrix [0, 60, 70, 80, 90], sample scores of 85, 67, 99, 92 and 89 are assigned letter grades F, D, C, B and A depending if the score exceeds 0, 60, 70, 80 or 90, respectively. I've used it in ways analogous to your use case.

 

Cheers,

Brady

 

Words( "FDCBA", "" )[Loc Sorted( [0, 60, 70, 80, 90], [85, 67, 99, 92, 89] )];

brady_brady_0-1620871449883.png

 

Phil_Kay
Staff

Re: join data based on approximate time stamp

Another idea that you might wish to check is using JMP Query Builder to do "fuzzy" joins.

I looked at this for someone that wanted to identify chemical components that are within a certain range of mass from mass spectrometry.

I have attached 3 tables as an example. The Joined table has class from the Ref table where Mass in the Data table is within the range of Mass Low and Mass High.

I am happy to provide more guidance if you think this solution would be useful.

This is how the fuzzy join is defined in JMP Query Builder:

Screenshot 2021-05-13 121130.png

Recommended Articles