忽略“排除”行你好,
我仍在嘗試克服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匯總功能,我認為兩者都可以很快得到您的答案。