您始終能夠將數據表中的列作為一維向量添加下標。在 JMP 13 中,您可以將數據表作為二維數組添加下標。以下是一些使用大類的示例。(最後一個示例顯示了列下標。)

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"}
數據表下標使得使用表比以前更容易;您可以使用單個(稍微複雜)語句交換行或列,或者將塊從一個表複製到另一個表,或者使用行矩陣和標識子集的列列表從表的子集中提取矩陣。
克雷格@JMP
極好的!, 這為“數據表編程”,或者更確切地說,基於矩陣的編程提供了很多可能性。