一致した列名に基づいてセルを強調表示するテーブル内のすべての Studentized 列の最小値を黄色にするスクリプトがあります。 生の列内のこれらの値に隣接する値も強調表示したいと考えています。 たとえば、Studentized Resid Rest Pulse の場合、Rest Pulse 列の -2.321144119 に隣接するセル、つまり 44。 JSLでこれを行うにはどうすればよいですか? 正規表現や一致は役に立ちますか? ありがとう
dt = current data table();
col = dt << get column names( string );
nc = N Items( col );
For( i = 1, i <= nc, i++,
Cols = Column(dt,i);
If( Contains( col[i], "Studentized Resid" ),
Min = dt << get rows where(as column(Cols)==(Col Min( Cols )));
Cols << color cells(Yellow, Min);
)
);
私は次のようなものを探しています:

Re: 一致した列名に基づいてセルを強調表示する@ジェフ・パーキンソンこんにちはジェフ、私はすでに部分文字列の部分を解決しました。 でもありがとう!!Re: 一致した列名に基づいてセルを強調表示する@txnelsonこのようなことを意味しますか?
dt = Current Data Table();
// I changed the name from "col" to colNameList to keep from
// it being confused with the variable "Cols". It isn't
// confusing to JMP, just to me
colNameList = dt << get column names( string );
nc = N Items( colNameLIst );
// Loop across all columns
For( i = 1, i <= nc, i++,
// Create a variable that contains the "column" representation
// of the column name string value
Cols = Column( dt, i );
// If the column name starts with the string "Studentized Resid"
// and if so, then process
// I changed this because your Substr() function below indicates
// that the column with "Studentized Resid" will be at the beginning
If( Left( colNameList[i], 17 ) == "Studentized Resid",
// Find the minimum value for the column
MinValue = Col Min( Cols );
// Find all of the rows that have the minimum value. There
// could be more than one row with the minimum value, but this
// code only uses the first row
MinRows = dt << get rows where( As Column( Cols ) == MinValue );
// Theoretically, there should always be a matching value for this,
// but it is a good way to make sure the code will not fail. Also,
// if you ever want to deal with the posibility of more than one
// row matching the minimum, you would do it using this type of
// code structure
If( N Rows( MinRows ) > 0,
Cols << color cells( Yellow, MinRows ),
//column( Substr( colNameList[i], 19 ) ) << color cells( Yellow, MinRows )
);<BR /> column( Substr( colNameList[i], 19 ) ) << color cells( Yellow, MinRows )
)
);
私はそれを仕事にしました。 ご指導ありがとうございました。
Re: 一致した列名に基づいてセルを強調表示する私はあなたの問題を理解していないかもしれません。「Studentized .....」を含む列で見つかった最小値に隣接するセルに色を付けたい場合は、それを実行するだけです。列名のリスト....colNamesList があり、列を調べています。「Studentized....」が含まれる列を見つけたら、色を付けたい他の列の名前と最小値の行を見つけます。つまり、色を付けるセルに隣接するセルもわかっていることになります。
column( Substr( colNameList[i], 19 ) ) << << color cells( Yellow, MinRows )<BR />
これを「Studentized....」列の色付けの直後に追加すると、適切なセルに色が付けられます。
Re: 一致した列名に基づいてセルを強調表示するそれはSubstr()不足している機能は何ですか?
resid_colname="Studentized Resid Rest Pulse";
//There are 19 characters in "Studentized Resid "
orig_colname = substr(resid_colname, 19);
show(orig_colname);
/*:
orig_colname = "Rest Pulse";
Re: 一致した列名に基づいてセルを強調表示する@txnelsonこんにちは、ジム、ここに何か欠けていたらごめんなさい。 すべてのスチューデント化された列の隣接する生の列も強調表示したいと思いました。 これを機能させることができません。
Re: 一致した列名に基づいてセルを強調表示するここでは、スクリプトを簡単に修正してみます。これはサンプル データで動作し、データ テーブルにあるのと同じ数の列で動作するはずです。
dt = Current Data Table();
// I changed the name from "col" to colNameList to keep from
// it being confused with the variable "Cols". It isn't
// confusing to JMP, just to me
colNameList = dt << get column names( string );
nc = N Items( colNameLIst );
// Loop across all columns
For( i = 1, i <= nc, i++,
// Create a variable that contains the "column" representation
// of the column name string value
Cols = Column( dt, i );
// If the column name starts with the string "Studentized Resid"
// and if so, then process
// I changed this because your Substr() function below indicates
// that the column with "Studentized Resid" will be at the beginning
If( Left( colNameList[i], 17 ) == "Studentized Resid",
// Find the minimum value for the column
MinValue = Col Min( Cols );
// Find all of the rows that have the minimum value. There
// could be more than one row with the minimum value, but this
// code only uses the first row
MinRows = dt << get rows where( As Column( Cols ) == MinValue );
// Theoretically, there should always be a matching value for this,
// but it is a good way to make sure the code will not fail. Also,
// if you ever want to deal with the posibility of more than one
// row matching the minimum, you would do it using this type of
// code structure
If( N Rows( MinRows ) > 0,
Cols << color cells( Yellow, MinRows )
);
// Output the requested values
Show( Substr( colNameList[i], 19 ), Cols[MinRows[1]] );
);
);
Re: 一致した列名に基づいてセルを強調表示するこの問題をどうやって解決すればよいのか、まだわかりません。 最新のスクリプトを見つけるために、他の質問やスクリプト ガイドを調べました。
私の最新のスクリプトは次のとおりです。
dt = current data table();
col = dt << get column names( string );
nc = N Items( col );
For( i = 1, i <= nc, i++,
Cols = Column(dt,i);
If( Contains( col[i], "Studentized Resid" ),
Min = dt << get rows where(as column(Cols)==(Col Min( Cols )));
Cols << color cells(Yellow, Min);
//show(Loc())
MinValue = Col Min(Cols);
ColValue = As List(Cols << Get Values);
show(Loc(ColValue,MinValue));
show(substr(col[i], 19,100));
)
);
Substring メソッドを使用して列を照合する方法を誰かが教えてくれれば幸いです。 前もって感謝します。
Re: 一致した列名に基づいてセルを強調表示するそれは合理的なアプローチのように思えます。
Re: 一致した列名に基づいてセルを強調表示するスチューデント化された列を持つ/一致するすべての生の列が強調表示されます。 私はスクリティングガイドを見て、正規表現一致と部分文字列を使用して、「Studentized Resid」を含まない列名を抽出しようとしました。 ここでも強調表示された列の行番号のリストを保持しており、それが私が望むことを達成するのに役立つことを願っています。 より良いアプローチがあれば大変感謝いたします。@txnelson
Re: 一致した列名に基づいてセルを強調表示する処理が必要な列の入力をどのように想定していますか?
スクリプト ガイドを読みましたか?この本にはアイデアを与えてくれる例がたくさんあります。
ヘルプ==>書籍==>スクリプトガイド
Re: 一致した列名に基づいてセルを強調表示する@pmrozご返信いただきありがとうございます。ただし、このような問題に対するより動的な解決策を探しています。
a) たくさんのコラム
b) 将来的には異なる列名になります。
このタスクを実行できる JMP 関数はありますか? ありがとう
Re: 一致した列名に基づいてセルを強調表示するハードコーディングされた列名を使用する 1 つの方法は次のとおりです。
dt = Current Data Table();
col = dt << get column names( string );
nc = N Items( col );
For( i = 1, i <= nc, i++,
Cols = Column( dt, i );
If( Contains( col[i], "Studentized Resid" ),
Min = dt << get rows where( As Column( Cols ) == (Col Min( Cols )) );
Cols << color cells( Yellow, Min );
:Rest Pulse << color cells( Yellow, Min );
:Run Pulse << color cells( Yellow, Min );
:Max Pulse << color cells( Yellow, Min );
);
);