忽略“排除”行你好,
我仍在尝试克服JSL的“驼峰”,因此请原谅基本问题。
问题:
-我有一个样本表,其中包含三个重复的数据集,样本后缀分别为a1,a2和a3。
-有时,其中一个副本需要设置为“已排除”状态(以下示例为a2)
-我正在编写一个批处理脚本,它将打开一个表并仅应用未排除的计算集。
-但是,由于仍在考虑来自这三个区域的数据,因此我仍无法进行尝试(如下所示)。
-我觉得可能需要“和”语句来标识未排除的行,然后应用后缀搜索。
任何输入,将是最感激的。
谢谢尼尔
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"));
);
)
数据表回复:忽略“排除”行看起来您正在遍历排除行的列表,但是每次都进行相同的分析,实际上并没有在任何地方引用排除行的列表。这是一种可能解决您的问题的方法,即获取匹配的行和排除的行,然后从列表中删除排除的行。
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;回复:忽略“排除”行嗯
非常感谢您的投入。 我还是个新手,但是对Associative Array概念很感兴趣。 代码将显示出来,并且可以在“获取密钥”中使用。 但是,我仍然不确定如何从“ 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);
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")];回复:忽略“排除”行非常感谢!
我会试一试,看看效果如何。
最初的目的只是从每组(a1,a2和a3)的每一行中获取孔隙率,并获得均值。 每次重复的孔隙率是相同的,但是找不到简单的方法来提取3个不同的点并取平均值。
再次感谢您的输入。
尼尔
回复:忽略“排除”行绝对要看一下制表平台和JSL汇总功能,我认为两者都可以很快得到您的答案。