如何从 R2 中减去 R1 的值并将结果添加到差异行?
您所要求的关键是记住 JMP 数据表不是电子表格。 我的建议是转置数据表,然后添加新的差异列。 然后,您将根据列中当前的组来分析差异。
1. 表格 > 转置
2. 选择您的标签列作为“标签”,然后选择所有其他列,然后单击“Transposne Columns”,然后单击“确定”。
现在您有了一个新表,其中有一列用于您的“组”的标签(您的列是什么)和两列数据,一列用于 R1,一列用于 R2。
3. 在这个新表中突出显示两个 R 列,右键单击,选择“新建公式列”>“合并”>“差值”。
现在您有了差异列,您可以分析各组之间的差异有何不同(即,使用图形生成器,将组标签作为 x,将差异作为 y)。
这是一个简单的脚本,可以满足您的要求
Names Default To Here( 1 );
// Create a sample data table
dt = New Table( "Untitled 4",
Add Rows( 3 ),
New Column( "Label",
Character,
"Nominal",
Set Values( {"#1", "#2", "Difference"} )
),
New Column( "A",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [5, 6, .] ),
Set Display Width( 43 )
),
New Column( "B",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [9, 7, .] )
),
New Column( "C",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [12, 4, .] ),
Set Display Width( 43 )
)
);
// Here is the code to subtract the values
For( i = 2, i <= N Cols( dt ), i++,
Column( dt, i )[3] = Column( dt, i )[1] - Column( dt, i )[2]
);@飞天小女警,
dt = Current Data Table();
Mat = dt << Get As Matrix;
Res = Mat[1,0] - Mat[2,0];
MatFinal = V Concat(Mat,Res);
dt_New = As Table(MatFinal);