「除外された」行を無視するこんにちは、
私はまだ JSL の「こぶ」を乗り越えようとしているところなので、根本的な質問をお許しください。
問題:
- サンプル接尾辞 a1、a2、および a3 を持つ 3 つの複製のデータ セットを含むサンプル テーブルがあります。
- 場合によっては、レプリケートの 1 つを「除外」状態に設定する必要があります (以下の例は a2)。
- テーブルを開いて、除外されなかったセットのみを計算に適用するバッチ スクリプトを作成しています。
- ただし、3 つすべてのデータがまだ検討中であるため、私の試み (以下に示す) はまだ達成されていません。
- 除外されていない行を特定し、サフィックスの検索を適用するには、「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"));
);
)
品質およびプロセスエンジニアリングRe: 「除外」行を無視するぜひ、表作成プラットフォームと要約 JSL 関数の両方を見てください。どちらもかなり早く答えが得られると思います。
Re: 「除外」行を無視するどうもありがとう!
これを試してみて、どうなるか見てみましょう。
当初の目的は、各セット (a1、a2、および a3) の 1 つの行から気孔率を取得し、平均を求めることだけでした。 空隙率は各複製で同じですが、3 つの異なる点だけを抽出して平均するこれより簡単な方法は見つかりませんでした。
ご意見ありがとうございます。
ニール
Re: 「除外」行を無視する以下は、アヤメデータテーブル内の各種を調べて、その基準に一致する行の平均を計算する更新されたスクリプトです。そうは言っても、あなたが何をしているのかをよりよく理解したので、私はこれを別の方法で行い、代わりに 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")
);
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);
//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")];Re: 「除外」行を無視するああ、
ご意見ありがとうございました。 私はまだ初心者ですが、連想配列の概念を試してみました。 コードが表示されており、「Get Keys」まで動作します。 ただし、必要な計算 (リストの最後の 6 行) を行うために「speciesmatches」から必要な情報を取得する方法がまだわかりません。 除外されたセットを含む典型的なテーブルの画像を撮りました。
ニール
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]]);
Re: 「除外」行を無視する除外された行のリストを繰り返し処理しているように見えますが、毎回同じ分析を行っていますが、実際には除外された行のリストをどこにも参照していません。ここでは、問題を解決する可能性のある 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;