こんにちは、
次の基準に基づいてループを使用して分布をプロットしようとしています。
- 少なくとも 1x 仕様制限 (LSL または USL) を持つ列のみをプロットする必要があります
- 選択した列の引数で分割する必要があります (SplitBy)
Eval(EvalExpr()) を使用して必要な式を作成しましたが、選択した列で分割する Where() 関数に苦労しています。
問題が再現できるように、失敗しているコードの部分を抽出し、最初にダミーのテーブル作成を追加しました。
私のトライアルには 3 つのオプションがあり、コメント化/コメント解除して以下のコードの問題を再現できます。
私の目標は、以下のオプション 1 のように、Where() で変数 "SplitBy" を適切に呼び出す式を構築することです (ただし、オプション 1 では ":CONFIG1" がハードコードされています)。
私の試みでは、オプション 2 と 3 (特に...) が失敗します (以下のログの抜粋)
Option 1:
dis = dt << Distribution(Continuous Distribution(Column("LogNormal 10,1"n)), Where(:CONFIG1 == “1"))
Option 2:
dis = dt << Distribution(Continuous Distribution(Column("LogNormal 10,1"n)), Where(Column("CONFIG1") == "1"))
This Where-clause for data table 'tabletest.jmp' resulted in no rows: Column( "CONFIG1" ) == "1"
Option 3:
dis = dt << Distribution(Continuous Distribution(Column("LogNormal 10,1"n)), Where(":CONFIG1" == "1"))
This Where-clause for data table 'tabletest.jmp' resulted in no rows: ":CONFIG1" == “1"式の評価がこのフォーラムで繰り返し話題になることは知っていますが、それを機能させるために多くの時間を費やしましたが、まだ成功していません 
よろしくお願いします
説教者
Names Default To Here( 1 );
clear symbols();
Deletesymbols();
//Create table with random distribution
dt = New Table( "tabletest",
Add Rows( 150 ),
New Column( "LogNormal 10,1", Numeric, "Continuous", formula( Random Lognormal( 10, 1 ) ) ),
New Column( "Normal 10,1", Numeric, "Continuous", formula( Random Normal( 10, 1 ) ) ),
New Column( "Gamma 10,1", Numeric, "Continuous", formula( Random Gamma( 10, 1 ) ) ),
New Column( "Normal 10,2", Numeric, "Continuous", formula( Random Gamma( 10, 2 ) ) ),
New Column( "CONFIG1", Character, "Nominal", formula(char(Random Integer( 1, 3 )))),
New Column( "CONFIG2", Character, "Nominal", formula(char(Random Integer( 1, 3 ))));
);
Column( dt, "LogNormal 10,1" ) << set property( "spec limits", {LSL( 0 ), USL( 400000 ), Show Limits( 0 )} );
Column( dt, "Normal 10,1" ) << set property( "spec limits", {LSL( 6 ), USL( 14 ), Show Limits( 0 )} );
Column( dt, "Gamma 10,1" ) << set property( "spec limits", {LSL( 0 ), USL( 40 ), Show Limits( 0 )} );
dt << save( "$Desktop\tabletest.jmp" );
SplitBy = "CONFIG1";
//Get a list from all unique configs
summarize(ColumnSplitBy=by(Column (SplitBy)));
show(ColumnSplitBy);
For( i = N Items( ColumnSplitBy ), i > 0, i--,
If( ColumnSplitBy[i] == "",
Remove From( ColumnSplitBy, i, 1 );
)
);
//Get Column only with limits (At east LSL or USL, I don't care about target)
MetricCols = dt << Get Column Names( numeric, continuous );
Show( MetricCols );
For( i = N Items( MetricCols ), i >= 1, i--,
Q = Column( MetricCols[i] ) << Get Property( "Spec limits" );
Show( Q );
spec_x = Eval List( {Arg( Q, 1 )/*, Arg( Q, 2 ), Arg( Q, 3 )*/} );
Show( spec_x );
If( N Row( Loc( spec_x, Empty() ) ),
Remove From( MetricCols, i )
);
);
k=1;
//Loop to run through all configs
For ( j = 1, j <= N Items( ColumnSplitBy ), j++,
Show( j );
//Loop to run Distribution > Fit ALL > Capability and collect the stats
For( i = 1, i <= N Items( MetricCols ), i++,
Show( i );
////////////////////////////////////////////////////// Option 1: That works well, but :CONFIG1 is hardcoded
x = Eval Expr(
dis = dt << Distribution(
Continuous Distribution( Column( Expr(MetricCols[i] ))),
Where(:CONFIG1 == Expr(ColumnSplitBy[j])))
);
print (x);
Eval (x);
/* ////////////////////////////////////////////////////// Option 2 : That doesn't work
x = Eval Expr(
dis = dt << Distribution(
Continuous Distribution( Column( Expr(MetricCols[i] ))),
Where(Expr(Column(SplitBy)) == Expr(ColumnSplitBy[j])))
);
print (x);
Eval (x); */
/* ////////////////////////////////////////////////////// Option 3 : That doesn't work
x = Eval Expr(
dis = dt << Distribution(
Continuous Distribution( Column( Expr(MetricCols[i] ))),
Where(Expr(":"||SplitBy) == Expr(ColumnSplitBy[j])))
);
print (x);
Eval (x); */
);
);これはあなたのために役立つと信じています
x = Eval Expr(
dis = dt << Distribution(
Continuous Distribution( Column( Expr(MetricCols[i] ))),
Where(as column(SplitBy) == Expr(ColumnSplitBy[j])))
);