如何編寫分組依據以處理靈活的分組數量你好,
致力於自動化分析,需要使自動生成的腳本更具通用性。
工作流程是創建一個匯總表,該表由三列組成,其中四列獲取派生值。 那樣就好。
現在,我想用原始分組變量之一創建單向圖,然後再用第二個變量對圖進行分組。
分組:循環,步驟,唯一步驟
4個單獨的“單週期循環”分組的步驟。
自動生成的腳本可以在我的測試文件上正常運行。 問題是如何使其更通用。
如果我看一下腳本,則有針對步驟列值的特定標註
<< {在行中排列(4)},Where(:Step == 1),Where(:Step == 1))
在測試用例中,step有19個值。 我應該如何精心設計以適應步驟數? 各種文件將具有不同數量的步驟。 什麼是最佳做法? 我希望得出的結果是將四個圖連續放置,並在分組框中同時顯示步驟的值(現在在圖之後以小文本顯示),並自動設置傳入文件可能具有的步驟數。
安迪
dt1=Data Table( dt) <<SUMMARY></SUMMARY>
腳本編寫回复:如何編寫分組依據腳本以處理靈活的分組數量取得了一些進展。
可以通過使用“按”運算符來處理大量工作。
仍然缺少的是如何將組以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 )} )
)
);回复:如何編寫分組依據腳本以處理靈活的分組數量下面是一個示例,將4個圖形放在一行中,並為分析中指定的每一列添加了一行

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++;
)
)
;
回复:如何編寫分組依據腳本以處理靈活的分組數量你好,
在代碼的最後一部分,我在i ++調用周圍遇到錯誤。 我沒有看到在代碼的前面初始化過的變量i。 它指的是什麼?
安迪