データQAと再フォーマットこんにちは、みんな、
私のワークフローの一般的なスローダウン手順は、クライアントが「<0.01」または検出限界を下回るサンプルの他の任意の数を含む結果を含むスプレッドシートを私たちに送信することです。これらの値の代入を計算する内部Rコードがありますが、データセットを再フォーマットする必要があります(ここに添付されている例)。ファイルから、2つの別個のCSVを作成する必要があります。1つは非検出がゼロで置き換えられたもの(検出ファイルが添付されたもの)で、もう1つはすべての値がゼロで非検出が「<」記号なしの検出限界で置き換えられたものです(添付ファイルを検出しない)。
データセットからこれらの2つのCSVを作成するためにこのプロセスを自動化する方法を知っている人はいますか?JMPにこの機能があるか、誰かが一般的なスクリプトを提供できるとしたら、ワクワクするでしょう。
スクリプティングRe:データQAと再フォーマットこれは、JMPにとってかなり単純なタスクです。 (セクションを編集した後)このコードを実行し、必要なものが得られるかどうかを確認します。 次に、JMPドキュメントライブラリにアクセスし、スクリプティングガイドを読む必要があります。これにより、以下のコードが何を行っているかを理解できます。
Names Default To Here( 1 );
// Open the Excel spreadsheet that has the issues
dt = Open( "<YOUR path="">\Sample Client Data.xlsx" );
// Get all of the character columns
colNames = dt << get column names( string, character );
// Go across all of the character columns, and if "<0.0" is found in one
// or more cells, then change those cells to 0. Then convert the column
// to a numeric column
For( i = 1, i <= N Items( colNames ), i++,
dt << select where( Contains( As Column( colNames[i] ), "<0.0" ) );
selRows = dt << get selected rows;
If( N Rows( selRows ) > 0,
Column( dt, colNames[i] )[selRows] = "0";
Column( dt, colNames[i] ) << data type( numeric ) << modeling type( continuous );
);
);
// Save the Detect version of the data
dt << save( "<YOUR path="">\Detect.csv" );
Close( dt, nosave );
// Reopen the Excel spreadsheet that has issues
dt = Open( "<YOUR path="">\Sample Client Data.xlsx" );
// Get all of the character columns
colNames = dt << get column names( string, character );
// Go across all of the character columns, and if "<0.0" is found in one
// or more cells, then loop through the cells getting rid of the "<"
// Then convert the column to a numeric column
For( i = 1, i <= N Items( colNames ), i++,
dt << select where( Contains( As Column( colNames[i] ), "<0.0" ) );
selRows = dt << get selected rows;
If( N Rows( selRows ) > 0,
For( k = 1, k <= N Rows( selRows ), k++,
theRow = selRows[k];
Column( dt, colNames[i] )[theRow] = Substr( Column( dt, colNames[i] )[theRow], 2 );
);
Column( dt, colNames[i] ) << data type( numeric ) << modeling type( continuous );
);
);
// Save the NonDetect version of the data
dt << save( "<YOUR path="">\NonDetect.csv" );
Close( dt, nosave );</YOUR></YOUR></YOUR></YOUR>
Re:データQAと再フォーマットこんにちはジム、
私はこれを調べましたが、タスクの2番目の部分がありません。また、すべての値をゼロに変更する「非検出」のスクリプトが必要です。
ループを実行し、値が> 0のすべてのセルを選択します(DL値が "<0.0"のセルを除く)。
送信したコードの最後の部分はうまく機能しています。「NonDetectPreprocess.csv」を挿入するだけです。
私が作成したこのカスタムスクリプトを使用してみました:
// Reopen the Excel spreadsheet that has issues
dt = Open( "D:\MD\Datto Workplace\Projects\Internal\JMP Scripts\Zero Imputation\Fake Client Data.csv" );
// Go across all of the character columns, and if concentration is greater than zero is found in one
// or more cells, then change those cells to 0. Then convert the column
// to a numeric column
For( i = 1, i <= N Items( colNames ), i++,
dt << select where( dt > 0 );
selRows = dt << get selected rows;
If( N Rows( selRows ) > 0,
Column( dt, colNames[i] )[selRows] = "0";
Column( dt, colNames[i] ) << data type( numeric ) << modeling type( continuous );
);
);
//Save this sheet for next step
dt << save("D:\MD\Datto Workplace\Projects\Internal\JMP Scripts\Zero Imputation\NonDetectPreprocess.csv" )
Close( dt, nosave );</CODE></PRE><P> </P><P> </P></LINGO-BODY><LINGO-SUB id="lingo-sub-288098" slang="en-US">Re:データQAと再フォーマット</LINGO-SUB><LINGO-BODY id="lingo-body-288098" slang="en-US"><P>頑張って....しかし、これはあなたが望むものだと思います</P>
<PRE><CODE class=" language-jsl">// Reopen the Excel spreadsheet that has issues
dt = Open( "<YOUR path="">\Sample Client Data.xlsx" );
// Get all of the character columns
colNames = dt << get column names( string, character );
// Go across all of the character columns, and if "<0.0" is found in one
// or more cells, then loop through the cells getting rid of the "<"
// Then convert the column to a numeric column
For( i = 3 i <= N Items( colNames ), i++,
dt << select where( ! Contains( As Column( colNames[i] ), "<0.0" ) );
selRows = dt << get selected rows;
If( N Rows( selRows ) > 0,
column( dt, colNames[i] )[selRows] = "0";
);
dt << invert row selection;
selRows = dt << get selected rows;
If( N Rows( selRows ) > 0,
For( k = 1, k <= N Rows( selRows ), k++,
theRow = selRows[k];
Column( dt, colNames[i] )[theRow] = Substr( Column( dt, colNames[i] )[theRow], 2 );
);
Column( dt, colNames[i] ) << data type( numeric ) << modeling type( continuous );
);
);
// Save the NonDetect version of the data
dt << save( "<YOUR path="">\NonDetect.csv" );
Close( dt, nosave );</YOUR></YOUR>
Re:データQAと再フォーマットこんにちはジム、
私はあなたが逆行選択をしたことに気づきました。これは役立ちますが、問題は、「<0.0」を含む列のみが選択されることです。データセットに数値データがあるすべての列を選択して変更するにはどうすればよいですか?
助けてくれてありがとう!
Re:データQAと再フォーマットそれがより明確な場合は、写真でフォローアップします。黄色は、置き換えられた検出限界「<0.0」です。これらの列はゼロに置き換えられましたが、残りは変更されませんでした。

Re:データQAと再フォーマットああ、問題が表示されます.....以下の問題を修正しました.....私は信じています。 しかし、最初に、最初に何かを明確にしましょう。 JMPは、異なる列を読み取るときに、指定された列のすべてのデータを読み取り、その列が数値列か文字列かを決定します。 列が数値と見なされるためには、列のすべての値が数値である必要があります。 したがって、JMPは、非数値セル、つまり<0.0005の列を検出すると、その列を文字列として宣言します。 私のコードは、コードが「<」が見つかった列を見つけることができるという点で、それを利用しています。 また、JSLがSubstr()などの文字操作関数を使用して「<」を取り除き、セルに有効な数値を残すこともできます。 ただし、すべての「<」が削除されたら、列を数値列に変更できます...... <<データ型(数値)。 これが私の新しいコードです。データが読み込まれた直後、「<」列が処理される前に、数値として検出されたすべての列を0に変換します。 負の値であっても、数値列のすべての値を0に変更することを想定しています。 次に、コードは「<」列を修正し、「<」があったセルを除くすべての数値セルを0に変更します。
dt = Open( "C:\users\jim\documents\discussion group\Sample Client Data.xlsx" );
// Get all of the character columns
colNames = dt << get column names( string, character );
colNamesNum = dt << get column names( string, numeric );
// zero out all current numeric columns
For( i = 2, i <= N Items( colNamesNum ), i++,
column( dt, colNamesNum[i] )[1::N Rows(dt)] = 0;
);
// Go across all of the character columns, and if "<0.0" is found in one
// or more cells, then loop through the cells getting rid of the "<"
// Then convert the column to a numeric column
For( i = 1, i <= N Items( colNames ), i++,
dt << select where( ! Contains( As Column( colNames[i] ), "<0.0" ) );
selRows = dt << get selected rows;
If( N Rows( selRows ) > 0,
column( dt, colNames[i] )[selRows] = "0";
);
dt << invert row selection;
selRows = dt << get selected rows;
If( N Rows( selRows ) > 0,
For( k = 1, k <= N Rows( selRows ), k++,
theRow = selRows[k];
Column( dt, colNames[i] )[theRow] = Substr( Column( dt, colNames[i] )[theRow], 2 );
);
Column( dt, colNames[i] ) << data type( numeric ) << modeling type( continuous );
);
);
// Save the NonDetect version of the data
dt << save( "<YOUR path="">\NonDetect.csv" );
Close( dt, nosave );</YOUR>