選擇具有多個標準的演員我的數據有來自同一個 Actor 的多個觀察結果。我想找到滿足基於多列的標準的 Actors - 但會在同一 Actor 的不同觀察中滿足不同的標準。
例子:

我想找到滿足以下條件的演員:
尺碼 < 250
和
對於比賽 A:得分 1 > 10 和得分 2 > 10
和
對於比賽 B:得分 1 > 10 和得分 2 > 40
和
對於比賽 C:得分 3 > 50
所以對於上表,它應該告訴我演員 B。
謝謝!
回复:選擇具有多個標準的演員你好,
一種方法是連續相交關聯數組,如下所示。
乾杯,
布雷迪
Names Default To Here( 1 );
dt = New Table( "Example",
Add Rows( 9 ),
New Column( "Actor", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [1, 2, 3, 1, 2, 3, 1, 2, 3] ) ),
New Column( "Competition", Character, "Nominal", Set Values( {"A", "A", "A", "B", "B", "B", "C", "C", "C"} ) ),
New Column( "Score 1", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [12, 13, 20, 25, 15, 16, 16, 15, 12] ) ),
New Column( "Score 2", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [12, 46, 45, 25, 48, 34, 59, 45, 56] ) ),
New Column( "Score 3", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [45, 50, 55, 60, 45, 80, 52, 61, 43] ) ),
New Column( "Size", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [100, 200, 300, 100, 200, 300, 100, 200, 300] ) )
);
critExprList = {
Expr( :competition == "A" & :Score1 > 10 & :Score 2 > 10),
Expr( :competition == "B" & :Score1 > 10 & :Score 2 > 40),
Expr( :competition == "C" & :Score3 > 50)
};
ansAA = Associative Array( dt:actor[dt << get rows where( :size < 250 )] );
For( i = 1, i <= N Items( critExprList ), i++,
Eval(
Substitute( Expr( curAA = Associative Array( dt:actor[dt << get rows where( _CLAUSE_ )] ) ), Expr( _CLAUSE_ ), eval( critExprList[i] ) )
);
ansAA << Intersect (curAA)
);
dt << select where(contains(ansAA << get keys, :actor));回复:選擇具有多個標準的演員感謝您的回复!
是的,這就是我使用的變通方法,但我很好奇同一個數據表中是否有一種方法,而不是拆分成一個新的。
在當前結構中可能無法完成,但我沒有足夠的經驗知道。回复:選擇具有多個標準的演員我關於如何進行此選擇的解決方案是將數據表重塑為每個演員一行,然後使用所需的選擇標準,讓每個演員的所有數據都可用。
Names Default To Here( 1 );
dt = New Table( "Example",
Add Rows( 9 ),
New Column( "Actor", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [1, 2, 3, 1, 2, 3, 1, 2, 3] ) ),
New Column( "Competition", Character, "Nominal", Set Values( {"A", "A", "A", "B", "B", "B", "C", "C", "C"} ) ),
New Column( "Score 1", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [12, 13, 20, 25, 15, 16, 16, 15, 12] ) ),
New Column( "Score 2", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [12, 46, 45, 25, 48, 34, 59, 45, 56] ) ),
New Column( "Score 3", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [45, 50, 55, 60, 45, 80, 52, 61, 43] ) ),
New Column( "Size", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [100, 200, 300, 100, 200, 300, 100, 200, 300] ) )
);
dtSplit = dt << Split(
Split By( :Competition ),
Split( :Score 1, :Score 2, :Score 3, :Size ),
Group( :Actor ),
Sort by Column Property
);
dtSplit << select where( (:Size A < 250 & :Score 1 A > 10 & :Score 2 A > 10 &
:Score 1 B > 10 & :Score 2 B > 40 & :Score 3 C > 50) |
(:Size B < 250 & :Score 1 A > 10 & :Score 2 A > 10 &
:Score 1 B > 10 & :Score 2 B > 40 & :Score 3 C > 50) |
(:Size C < 250 & :Score 1 A > 10 & :Score 2 A > 10 &
:Score 1 B > 10 & :Score 2 B > 40 & :Score 3 C > 50)
);
If(N Rows(dtSplit << get selected rows) > 0, Dialog("The Actor(s) is/are " || char( dtSplit<<GET selected="" rows=""></GET>

回复:選擇具有多個標準的演員感謝您的回复!
不幸的是,這是行不通的,因為如果我說“Competition = A AND (other A criteria) AND Competition = B”,它就會中斷,因為 Competition cannot = A & B。 但是如果我說,Competition = A AND (other A criteria) OR Competition = B AND (other B criteria),它給我的演員在任何比賽中都表現出色,但不是所有比賽。
抱歉,這有點難以解釋 - 問題出在分數 1、2 和 3 列中,其中包含來自不同比賽的結果。 一種解決方法是拆分錶格,將“Competition A Score 1”等列為列,但我正在尋找當前數據表中的解決方案。回复:選擇具有多個標準的演員選擇行 > 數據過濾器. 選擇標準中使用的每一列,並一次將它們添加到過濾器中。 然後,您可以為這些變量中的每一個設置所需的級別。 數據過濾器影響當前數據表中的行狀態。
看幫助 > JMP 文檔庫 > 使用 JMP有關詳細信息和示例的指南。