cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
%3CLINGO-SUB%20id%3D%22lingo-sub-21013%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%20mode%3D%22NONE%22%20mode%3D%22NONE%22%3EAbbonamento%20tabella%20dati%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-21013%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%20mode%3D%22NONE%22%20mode%3D%22NONE%22%3E%3CP%3ESei%20sempre%20stato%20in%20grado%20di%20indicizzare%20le%20colonne%20in%20una%20tabella%20di%20dati%20come%20vettori%20unidimensionali.In%20JMP%2013%20%C3%A8%20possibile%20sottoscrivere%20una%20tabella%20di%20dati%20come%20un%20array%20bidimensionale.Ecco%20alcuni%20esempi%20che%20utilizzano%20una%20grande%20classe.(L'ultimo%20esempio%20mostra%20l'indice%20di%20colonna.)%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2212872_pastedImage_0.png%22%20style%3D%22width%3A%20309px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2212872_pastedImage_0.png%22%20style%3D%22width%3A%20309px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2212872_pastedImage_0.png%22%20style%3D%22width%3A%20309px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2212872_pastedImage_0.png%22%20style%3D%22width%3A%20309px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2212872_pastedImage_0.png%22%20style%3D%22width%3A%20309px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F3783iDDC99E8545969843%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%2212872_pastedImage_0.png%22%20alt%3D%2212872_pastedImage_0.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Edt%20%3D%20Open(%22%24SAMPLE_DATA%5CBig%20class.jmp%22)%3B%0A%0A%2F%2F%20fetch%20a%20scalar%3B%20neither%20subscript%20is%20a%20matrix%0Adt%5B%204%2C%20%22height%22%5D%3B%20%2F%2F%2066%0A%0A%2F%2F%20fetch%20a%20matrix%20if%20either%20is%20a%20matrix%2C%20even%20if%201x1%0Adt%5B%20%5B4%5D%2C%20%22height%22%5D%3B%20%2F%2F%20%5B66%5D%0Adt%5B%204%2C%20%7Bheight%7D%5D%3B%20%2F%2F%20%5B66%5D%0A%0A%2F%2F%20fetch%20a%20list%20if%20character%20columns%20are%20involved.%26nbsp%3B%0A%2F%2F%20notice%20the%20matrix%20is%20reversing%20the%20order%0Adt%5B%204%3A%3A2%2C%20%22name%22%5D%3B%20%2F%2F%20%7B%22JACLYN%22%2C%20%22JANE%22%2C%20%22LOUISE%22%7D%0A%0A%2F%2F%20fetch%20an%20entire%20dimension%20using%200%20for%20a%20subscript%0Adt%5B%201%2C0%20%5D%3B%20%2F%2F%20%7B%22KATIE%22%2C%2012%2C%20%22F%22%2C%2059%2C%2095%7D%0A%0A%2F%2F%20fetch%20by%20column%20names%0Adt%5B%5B1%2C3%2C5%5D%2C%7Bheight%2Cweight%7D%5D%3B%20%2F%2F%20%5B59%2095%2C%26nbsp%3B%2055%2074%2C%2052%2064%5D%0A%0A%2F%2F%20fetch%20by%20column%20numbers%20in%20matrix%20or%20list%0Adt%5B%5B1%2C3%2C5%5D%2C%5B2%204%205%5D%5D%3B%20%2F%2F%20%5B12%2059%2095%2C%2012%2055%2074%2C%26nbsp%3B%2012%2052%2064%5D%0Adt%5B%5B1%2C3%2C5%5D%2C%7B2%2C4%2C5%7D%5D%3B%20%2F%2F%20%5B12%2059%2095%2C%2012%2055%2074%2C%26nbsp%3B%2012%2052%2064%5D%0A%0A%2F%2F%20assignments%20work%20too.%26nbsp%3B%20first%2C%20fetch%20a%20copy%0Acopydt%20%3D%20dt%5B0%2C0%5D%3B%20%2F%2F%20make%20a%20list%20of%20the%20table's%20data%0A%0A%2F%2F%20Clear%20the%20table%0Adt%5B0%2C0%5D%20%3D%20.%3B%20%2F%2F%20all%20rows%20and%20cols%20are%20missing%0A%0A%2F%2F%20restore%20the%20table%0Adt%5B0%2C0%5D%20%3D%20copydt%3B%0A%0A%2F%2F%20reverse%20two%20columns%2C%20top%20to%20bottom%20and%20left%20to%20right%0A%2F%2F%20(do%20it%20again%20to%20repair%20the%20table!)%0Adt%5B1%3A%3Anrows(dt)%2C%7Bname%2Csex%7D%5D%20%3D%20dt%5Bnrows(dt)%3A%3A1%2C%7Bsex%2Cname%7D%5D%3B%0A%0A%2F%2F%20set%20from%20a%20matrix%0Adt%5B2%3A%3A3%2C%7Bage%2Cheight%2Cweight%7D%5D%20%3D%20%5B22%2070%20190%2C%2023%2073%20200%20%5D%3B%0A%0A%0A%2F%2F%20column%20subscripting%20still%20works...%0Adt%3Aname%5B4%3A%3A7%5D%3B%20%2F%2F%20%7B%22JACLYN%22%2C%20%22LILLIE%22%2C%20%22TIM%22%2C%20%22JAMES%22%7D%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIl%20subscripting%20della%20tabella%20dati%20rende%20pi%C3%B9%20facile%20lavorare%20con%20una%20tabella%20rispetto%20a%20prima%3B%20puoi%20scambiare%20righe%20o%20colonne%20con%20una%20singola%20istruzione%20(leggermente%20complicata)%2C%20o%20copiare%20blocchi%20da%20una%20tabella%20all'altra%2C%20o%20estrarre%20una%20matrice%20da%20un%20sottoinsieme%20della%20tabella%20utilizzando%20una%20matrice%20di%20righe%20e%20un%20elenco%20di%20colonne%20che%20identificano%20il%20sottoinsieme.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-68721%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%20mode%3D%22NONE%22%20mode%3D%22NONE%22%3EOggetto%3A%20Abbonamento%20tabella%20dati%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-68721%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%20mode%3D%22NONE%22%20mode%3D%22NONE%22%3E%3CP%3EFatto.%20Grazie.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-21016%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%20mode%3D%22NONE%22%20mode%3D%22NONE%22%3EOggetto%3A%20Abbonamento%20tabella%20dati%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-21016%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%20mode%3D%22NONE%22%20mode%3D%22NONE%22%3E%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CP%3EBuono%20a%20sapersi.Grazie!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-21015%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%20mode%3D%22NONE%22%20mode%3D%22NONE%22%3EOggetto%3A%20Abbonamento%20tabella%20dati%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-21015%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%20mode%3D%22NONE%22%20mode%3D%22NONE%22%3E%3CP%3EOh!Un%20altro%20miglioramento%20JSL%20inaspettato.Questo%20%C3%A8%20incredibile!%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EQuesto%20potrebbe%20essere%20persino%20migliore%20del%20miglioramento%20della%20velocit%C3%A0%20degli%20elenchi.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-21014%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%20mode%3D%22NONE%22%20mode%3D%22NONE%22%3EOggetto%3A%20Abbonamento%20tabella%20dati%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-21014%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%20mode%3D%22NONE%22%20mode%3D%22NONE%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Fpeople%2FCraige%40JMP%22%20target%3D%22_blank%22%3ECraige%40JMP%3C%2FA%3E%3C%2FP%3E%3CP%3EFantastico!%2C%20Ci%C3%B2%20apre%20molte%20possibilit%C3%A0%20per%20la%20%22programmazione%20di%20tabelle%20dati%22%2C%20o%20meglio%20la%20programmazione%20basata%20su%20matrici.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
Craige_Hales
Super User
Data table subscripting

You've always been able to subscript columns in a data table as one dimensional vectors.  In JMP 13 you can subscript a data table as a two dimensional array.  Here are some examples using big class.   (The very last example shows the column subscripting.)

 

12872_pastedImage_0.png

 

 

 

dt = Open("$SAMPLE_DATA\Big class.jmp");

// fetch a scalar; neither subscript is a matrix
dt[ 4, "height"]; // 66

// fetch a matrix if either is a matrix, even if 1x1
dt[ [4], "height"]; // [66]
dt[ 4, {height}]; // [66]

// fetch a list if character columns are involved. 
// notice the matrix is reversing the order
dt[ 4::2, "name"]; // {"JACLYN", "JANE", "LOUISE"}

// fetch an entire dimension using 0 for a subscript
dt[ 1,0 ]; // {"KATIE", 12, "F", 59, 95}

// fetch by column names
dt[[1,3,5],{height,weight}]; // [59 95,  55 74, 52 64]

// fetch by column numbers in matrix or list
dt[[1,3,5],[2 4 5]]; // [12 59 95, 12 55 74,  12 52 64]
dt[[1,3,5],{2,4,5}]; // [12 59 95, 12 55 74,  12 52 64]

// assignments work too.  first, fetch a copy
copydt = dt[0,0]; // make a list of the table's data

// Clear the table
dt[0,0] = .; // all rows and cols are missing

// restore the table
dt[0,0] = copydt;

// reverse two columns, top to bottom and left to right
// (do it again to repair the table!)
dt[1::nrows(dt),{name,sex}] = dt[nrows(dt)::1,{sex,name}];

// set from a matrix
dt[2::3,{age,height,weight}] = [22 70 190, 23 73 200 ];


// column subscripting still works...
dt:name[4::7]; // {"JACLYN", "LILLIE", "TIM", "JAMES"}

 

 

The data table subscripting makes it easier to work with a table than before; you can swap rows or columns with a single (slightly complicated) statement, or copy blocks from one table to another, or extract a matrix from a subset of the table using a matrix of rows and a list of columns that identify the subset.

Last Modified: Jun 25, 2019 5:11 PM
Comments