柔軟な数のグループを処理するために group by をスクリプト化する方法やあ、
分析の自動化に取り組んでおり、自動生成されたスクリプトをより汎用的にする必要があります。
ワークフローは、派生値を取得する 4 つの列を持つ 3 つの列でグループ化された集計テーブルを作成することです。 それは結構です。
ここで、元のグループ化変数の 1 つを使用して一方向プロットを作成し、2 番目の変数でプロットをさらにグループ化したいと考えています。
グループ化: サイクル、ステップ、ユニーク ステップ
4 つの個別の Oneway by Cycle グループ化されたステップ。
自動生成されたスクリプトは、テスト ファイルで正常に動作します。 問題は、それをより一般的にする方法です。
スクリプトを見ると、ステップ列の値に特定のコールアウトがあります
<<{行に並べる(4)}, Where(:Step == 1), Where(:Step == 1))
テストケースでは、ステップに 19 個の値があります。 これをステップ数に柔軟に対応するにはどうすればよいですか? ファイルによってステップ数が異なります。 ここでのベストプラクティスは何ですか? 私の望む結果は、4 つのプロットを 1 行に並べて、グループ ボックスにステップの値が表示されるようにすることです (現在、プロットの後に小さなテキストになっています)。
アンディ
dt1=Data Table( dt) <<SUMMARY></SUMMARY>
スクリプティングRe: 柔軟な数のグループを処理するために group by をスクリプト化する方法Line Up Boxを利用できますか?
New Window( "Row-Wise",
Line Up Box( N Col(2),
Oneway( Y( :weight ), X( :sex), By( :age ))
)
);
Re: 柔軟な数のグループを処理するために group by をスクリプト化する方法やあ、
txnelsonさん、ありがとうございました! いくつかの微調整を行い、簡素化し、機能するようにしました
私はこれを少し処理し、解決策に達しました。 新しいウィンドウは受信ボックスを 4 つのプロットの配置に設定するため、プロットの整列を簡素化できます。 アイテムの数を数えてループし、ボックスに追加するだけです。
view = dt1 << Oneway(
Y( {:"Min(TV Pres (torr))"n ,:"Min(DS Pres (torr))"n,:"Max(TV Pres (torr))"n, :"Max(DS Pres (torr))"n}),
X( :Cycle ),
by (:Step),
Quantiles( 1 ),
Means( 1 ),
Mean Diamonds( 0 ),
Box Plots( 1 ),
X Axis Proportional( 0 ),
Points Jittered( 1 ),
Grand Mean( 0 ),
SendToReport(
Dispatch( {}, "Quantiles", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Oneway Anova", OutlineBox, {Close( 1 )} ),
Dispatch( {"Oneway Anova"}, "Analysis of Variance", OutlineBox, {Close( 1 )} )
)
);
nw = New Window( "test", lub = Lineup Box( N Col( 4 ) ) );
numRows = N Items( view );
For( theRow = 1, theRow <= numRows, theRow++,
lub << append( Report(view[(theRow)]) <BR /> );
アンディ
Re: 柔軟な数のグループを処理するために group by をスクリプト化する方法やあ、
コードの最後のビットの i++ 呼び出しでエラーが発生します。 コードの前半で初期化された変数 i が表示されません。 それは何を指していますか?
アンディRe: 柔軟な数のグループを処理するために group by をスクリプト化する方法以下は、4 つのグラフを 1 つの行に配置し、分析で指定された列ごとに行を配置する例です。

Names Default To Here( 1 );
dt1 = Open( "$SAMPLE_DATA\big class.jmp" );
// restrict to 4 ages to match the 4 level requirement
dt1 << select where( :age >= 16 );
dt1 << delete rows;
// Create a window to place the output in
nw = New Window( "test", lub = Lineup Box( N Col( 4 ) ) );
// Run the analysis with a By clause
view = dt1 << Oneway(
invisible,
Y( :height, :weight ),
X( :sex ),
Quantiles( 1 ),
Means( 1 ),
Box Plots( 1 ),
Mean Diamonds( 1 ),
by( :age ),
SendToReport(
Dispatch( {}, "Quantiles", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Oneway Anova", OutlineBox, {Close( 1 )} ),
Dispatch( {"Oneway Anova"}, "Analysis of Variance", OutlineBox, {Close( 1 )} )
)
);
// Take the elements from the outout and place in the window
// The display produces all levels of the by across one level
// of by group and then moves onto the next by group. Therefore
// the displays need to be picked across the full range of outputs
// to get the four grqaphs aligned
numCols = N Items( view ) / 4;
For( col = 1, col <= numCols, col++,
For( theRow = 1, theRow <= 4, theRow++,
lub << append( Report( view[(theRow - 1) * numCols + col] ) );
i++;
)
)
;
Re: 柔軟な数のグループを処理するために group by をスクリプト化する方法いくつかの進歩を遂げました。
「By」演算子を使用すると、大部分の作業を処理できます。
まだ欠けているのは、グループを4つのグループに配置して、グループ化によるそれぞれのプロットが同じ線上にあるようにする方法です。
何かご意見は
アンディ
view = dt1 << Oneway(
Y( {:"Min(TV Pres (torr))"n ,:"Min(DS Pres (torr))"n,:"Max(TV Pres (torr))"n, :"Max(DS Pres (torr))"n}),
X( :Cycle ),
by (:Step),
Quantiles( 1 ),
Means( 1 ),
Mean Diamonds( 0 ),
Box Plots( 1 ),
X Axis Proportional( 0 ),
Points Jittered( 1 ),
Grand Mean( 0 ),
SendToReport(
Dispatch( {}, "Quantiles", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Oneway Anova", OutlineBox, {Close( 1 )} ),
Dispatch( {"Oneway Anova"}, "Analysis of Variance", OutlineBox, {Close( 1 )} )
)
);