选择具有多个标准的演员我的数据有来自同一个 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有关详细信息和示例的指南。