JSL を使用して動的な列数を選択し、条件を満たす列を選択しますhttps://www.jmp.com/support/help/14-2/use-set-selected-to-select-columns.shtml
このようなものを書き直す最良の方法は何ですか?
その目的は、DT が TRANSPOSE と CATEGORY_TABLE の結合であるということです。
- CATEGORY_TABLE は、Category 列を含む 1 列のテーブルです。
- TRANSPOSE はデータの転置の結果です
重要なのは、TRANSPOSE の列数が常に同じであるとは限らないということです。紛らわしいことに、転置関数の出力では、追加の列に Row 1、Row 2 などの名前が付けられます。
- TRANSPOSE の最初の 2 列は常に同じです。
- 列 行 1 は常に 3 列目として存在します。
- データセットによっては、列 2 以降が存在する場合があります。
Join() が少なくとも行 1 列を選択し、さらに最後の列までが選択されるように Select() 関数を作成できますか?
// This section is only build to handle two columns named Row 1 and Row 2
DT = Data Table( TRANSPOSE ) << Join(
With( Data Table( CATEGORY_TABLE ) ),
Select( :Forecast Material ),
SelectWith( :Category ),
Select( :Row 1, :Row 2 ), // sometimes there is only one row, sometimes there are more than one rows ******How to handle this?********
By Matching Columns( :Label = :Category ),
Drop multiples( 0, 0 ),
Include Nonmatches( 0, 0 ),
Preserve main table order( 1 )
);
Re: JSL で動的な行数を選択し、条件を満たす行を選択するありがとうBSwid。仕組みを教えてください。
Re: JSL で動的な行数を選択し、条件を満たす行を選択するありがとうドン。他の人のコードを更新しようとしています。これは私たちがやりたいことをやっていると思います。解決策として受け入れる前に、時間をかけて検証する必要があります。私が見ていなかったと思われたくなかったし、あなたの反応に感謝していました。昨日はこの提案に基づいて作業していました。ありがとう!Re: JSL で動的な行数を選択し、条件を満たす行を選択する「Select」を含む引数を削除します。
DT = Data Table( TRANSPOSE ) << Join(
With( Data Table( CATEGORY_TABLE ) ),
By Matching Columns( :Label = :Category ),
Drop multiples( 0, 0 ),
Include Nonmatches( 0, 0 ),
Preserve main table order( 1 )
);
結果には、両方のテーブルのすべての列が含まれます。
Re: JSL で動的な行数を選択し、条件を満たす行を選択するこのようなことを試してみましたが、 「不正な引数」のアクセスまたは評価で列が見つかりません {1} というエラーが発生しました。
私が想像するのは、 Join()内のSelect( ) 内の引数です。
列のベクトルを変数に代入し、その変数を Select() の引数として使用できるのではないかと考えました。
// Get a list of the column names
colList = TRANSPOSE << Get Column Names();
// Starting with column 3, select
For(i=3,i<= N Cols( TRANSPOSE ), i++, COLUMN( TRANSPOSE , colList[i]) << Set Selected(1) ) ;
// Assign those selected columns to a variable
Select_cols = TRANSPOSE << Get Selected Columns();
//then feed that variable into the Select() withing Join()
<SPAN class="token comment">// 参加する</SPAN>
DT <SPAN class="token operator">=</SPAN> <SPAN class="token function">データ表</SPAN><SPAN class="token punctuation">(</SPAN> TRANSPOSE <SPAN class="token punctuation">)</SPAN> <SPAN class="token operator"><</SPAN><SPAN class="token operator"><</SPAN><SPAN class="token messages">参加する</SPAN><SPAN class="token punctuation">(</SPAN>
With<SPAN class="token punctuation">(</SPAN> <SPAN class="token function">データ表</SPAN><SPAN class="token punctuation">(</SPAN> CATEGORY_TABLE <SPAN class="token punctuation">)</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN>
Select<SPAN class="token punctuation">(</SPAN> <SPAN class="token punctuation">:</SPAN>Forecast Material <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN>
SelectWith<SPAN class="token punctuation">(</SPAN> <SPAN class="token punctuation">:</SPAN>Category <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN>
Select<SPAN class="token punctuation">(</SPAN> Select_cols <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN> /// was Select<SPAN class="token punctuation">(</SPAN> <SPAN class="token punctuation">:</SPAN>Row <SPAN class="token number">1</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token punctuation">:</SPAN>Row <SPAN class="token number">2</SPAN> <SPAN class="token punctuation">)</SPAN>
By Matching Columns<SPAN class="token punctuation">(</SPAN> <SPAN class="token punctuation">:</SPAN>Label <SPAN class="token operator">=</SPAN> <SPAN class="token punctuation">:</SPAN>Category <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN>
Drop multiples<SPAN class="token punctuation">(</SPAN> <SPAN class="token number">0</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token number">0</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN>
Include Nonmatches<SPAN class="token punctuation">(</SPAN> <SPAN class="token number">0</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token number">0</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN>
Preserve main table order<SPAN class="token punctuation">(</SPAN> <SPAN class="token number">1</SPAN> <SPAN class="token punctuation">)</SPAN>
<SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>