忽略“排除”行你好,
我仍在努力克服 JSL“驼峰”,所以请原谅这个基本问题。
问题:
- 我有一个样本表,其中包含三个重复的数据集,样本后缀为 a1、a2 和 a3。
- 有时,需要将其中一个重复设置为“排除”状态(下面的示例是 a2)
- 我正在编写一个批处理脚本,它将打开一个表并仅应用未排除的集合的计算。
- 然而,我仍然没有进行我的尝试(如下所示),因为来自所有三个的数据仍在考虑中。
- 我觉得可能需要使用“and”语句来识别非排除行,然后应用后缀搜索。
任何意见,将不胜感激。
谢谢尼尔
states = Current Data Table() << Get Row States();
For( i = 1, i <= N Rows( states ), i++,
rs = As Row State( states[i] );
if (Excluded(rs)==0,
a1 = dt << Get Rows Where(Contains(:Sample,"a1"));
a2 = dt << Get Rows Where(Contains(:Sample,"a2"));
a3 = dt << Get Rows Where(Contains(:Sample,"a3"));
);
)
质量和工艺工程回复:忽略“排除”行一定要看看 tabulate 平台和 summarise JSL 函数,我认为两者都可以很快得到答案。
回复:忽略“排除”行非常感谢!
我会尝试一下,看看效果如何。
最初的目的只是获取每组(a1、a2 和 a3)的一行的孔隙率并获取平均值。 每个重复的孔隙率是相同的,但无法找到更简单的方法来提取 3 个不同的点并求平均值。
再次感谢您的意见。
尼尔
回复:忽略“排除”行这是一个更新的脚本,它遍历虹膜数据表中的每个物种,并计算符合该条件的行的平均值。也就是说,既然我更好地理解了你在做什么,我可能会以不同的方式处理这个问题,并使用 tabulate 来查找这些值。
Names default to here(1);
//Make a sample dataset with some excluded rows
dt = Open("$Sample_data/iris.jmp");
excluded rows to set = [ 4, 9, 52 ];
dt << Select Rows( excluded rows to set );
dt << Exclude(1);
species list = {"setosa", "versicolor", "virginica"};
//For each species
for(s=1, s<= n items (species list), s++,
//Find all matching rows and load in associative array, useful for Remove From function later
species matches = associative array(dt << Get Rows Where(:Species == species list[s]));
//get excluded rows
excluded rows = dt << get excluded rows();
//remove excluded rows from the list of rows matching the species
Remove From (species matches, excluded rows);
//get the matching rows as a list, use that to find which rows to average
mn = mean( :Sepal length[speciesmatches << get keys] );
//output averages to the log
write(species list[s] || " mean = " || char(mn) || "\!n")
);
使用表格的选项:
Names default to here(1);
//Make a sample dataset with some excluded rows
dt = Open("$Sample_data/iris.jmp");
excluded rows to set = [ 4, 9, 52 ];
dt << Select Rows( excluded rows to set );
dt << Exclude(1);
//New column with the check for each value
New Column("Species_", Character, "Nominal", Formula(If(Contains(:Species, "se"), "se", Contains(:Species, "ve"), "ve", Contains(:Species, "vi"), "vi")));
//tabulate to find averages - script copied from 'source' of data table after selecting
//'make into data table' from tabulate platform, then inserted dt reference
dtTab = (dt << Tabulate(
Set Format( Mean( :Sepal length( 10, 4 ) ) ),
Add Table(
Column Table( Analysis Columns( :Sepal length ), Statistics( Mean ) ),
Row Table( Grouping Columns( :Species_ ) )
)
)) << Make Into Data Table;
//Now get values from the table
dtTab:"Mean(Sepal length)"n[dtTab << Get Rows Where(:Species_ == "se")];回复:忽略“排除”行呃,
非常感谢您的意见。 我还是个新手,但尝试了一下关联数组的概念。 显示代码并将一直工作到“获取密钥”。 但是,我仍然不确定如何从“speciesmatches”中获取所需的信息来进行所需的计算(列出最后 6 行)。 我拍摄了一张包含排除集的典型表格的图像。
尼尔
dt = Open( path );
// Find row that were excluded and load into list
Exc_row = dt << Get Excluded Rows;
dt << Select Rows( Exc_row );
dt << Exclude(1);
//Find all matching rows and load in associative array, useful for Remove From function later
species matches = associative array(dt << Get Rows Where(Contains(:Sample,"a1") |Contains(:Sample,"a2") |Contains(:Sample,"a3")));
//get excluded rows
Exc_row = dt << get excluded rows();
//remove excluded rows from the list of rows matching the species
Remove From (species matches, Exc_row);
//get the matching rows as a list
speciesmatches << get keys;
// What needs to be done to get mean of three (or 2 sets in the case of exclusion see table image)
a1 = dt << Get Rows Where(Contains(:Sample,"a1"));
a2 = dt << Get Rows Where(Contains(:Sample,"a2"));
a3 = dt << Get Rows Where(Contains(:Sample,"a3"));<BR />
c1 = Column("Image A pore area (%)");
mean1 = Mean(c1[a1[1]], c1[a2[1]], c1[a3[1]]);
回复:忽略“排除”行看起来您正在迭代排除行的列表,但每次都进行相同的分析,这实际上并没有在任何地方引用排除行的列表。这是可能解决您的问题的一种方法,它获取匹配的行和排除的行,然后从列表中删除排除的行。
Names default to here(1);
//Make a sample dataset with some excluded rows
dt = Open("$Sample_data/iris.jmp");
excluded rows to set = [ 4, 9, 52 ];
dt << Select Rows( excluded rows to set );
dt << Exclude(1);
//Find all matching rows and load in associative array, useful for Remove From function later
species matches = associative array(dt << Get Rows Where(:Species == "setosa"));
//get excluded rows
excluded rows = dt << get excluded rows();
//remove excluded rows from the list of rows matching the species
Remove From (species matches, excluded rows);
//get the matching rows as a list
speciesmatches << get keys;