如果数据表中每个样本有多个条目,如何为列表中的每个样本运行脚本。我有一个数据表,其中多次测量了相同的样本(请参见下面的示例)。 样本由它们的标识符分隔。

我希望我的脚本能够对每个样本执行相同的一组计算,以便我可以确定控制限并制作 A、B、C 等的控制图。 我不知道每个样本的标识符。 我已经有一个可以进行计算并为我制作图表的脚本,它只是无法对每个标识符进行单独的计算。
我最初的通过是使用某种循环来做到这一点。 我有一个脚本,它返回列表中的每个唯一标识符,并为我提供唯一标识符的数量作为循环设置。
Identifiers = Column( "Identifier") << GetAsMatrix();
Identifiers set = Associative Array( Identifiers);
Unique Identifiers = Identifiers set << Get Keys;
nUnique Identifiers = N Items (Unique Identifiers);
我只是似乎无法让循环工作。 有一个更好的方法吗? 或者有人可以告诉我如何做循环?
我正在使用 JMP 10。
谢谢!
脚本编写回复:如果数据表中的每个样本有多个条目,如何为列表中的每个样本运行脚本。有很多方法可以做到这一点,但一种方法是向现有平台添加本地数据过滤器。这是使用图形构建器的示例:
Names default to here(1);
//Open some sample data
dt = Open( "$Sample_data/big class.jmp" );
//Your code
Identifiers = Column( "age") << GetAsMatrix();
Identifiers set = Associative Array( Identifiers);
Unique Identifiers = Identifiers set << Get Keys;
nUnique Identifiers = N Items (Unique Identifiers);
//A window to hold a bunch of graphs
win = New Window("Graphs", graphbox = v list box());
//Open a graph that is filtered to only show each unique identifier
//to keep things organized add it to a single window.
for( i=1, i<=nUnique Identifiers, i++,
win << Append(<BR /> //To get this script I opened graph builder and added a local data filter for one age<BR /> //and then copied/pasted it here and replaced the age with 4Unique Identifiers[i]
Graph Builder(
Size( 534, 456 ),
Show Control Panel( 0 ),
Variables( X( :height ), Y( :weight ) ),
Elements( Points( X, Y, Legend( 2 ) ) ),
Local Data Filter(
Close Outline( 1 ),
Add Filter(
columns( :age ),
Where( :age == Unique Identifiers[i] ),
Display( :age, N Items( 6 ) )
)
)
)
)
);回复:如果数据表中的每个样本有多个条目,如何为列表中的每个样本运行脚本。我想知道使用内置控制图平台来计算限制和绘制度量是否有效,尤其是当您将 Identifier 分配给 By analysis 角色时。
只是不希望您花费大量时间编写脚本,如果它重复了已经可用的功能。
回复:如果数据表中每个样本有多个条目,如何为列表中的每个样本运行脚本。我如何能够进行由标识符过滤的额外计算? 我想做一些数据操作,然后根据每个标识符的数据计算我自己的限制,然后将这些数据添加到每个图表中,所以我认为任何类型的过滤器都需要在最终图表脚本之前出现。 我有一个可以做到这一点的脚本,如果需要我可以发布它,但它很长。 我真的只是在寻找一种方法来制作我已经为每个标识符而不是数据表中的所有行运行的脚本