데이터 QA 및 재 포맷안녕하세요,
내 워크 플로의 일반적인 속도 저하 절차는 클라이언트가 '<0.01'또는 탐지 한계 미만인 샘플에 대해 다른 임의의 숫자가 포함 된 결과가 포함 된 스프레드 시트를 보내는 것입니다. 이러한 값에 대한 대치를 계산하는 내부 R 코드가 있지만 데이터 세트의 형식을 다시 지정해야합니다 (여기에 첨부 된 예제). 파일에서 두 개의 개별 CSV를 생성해야합니다. 하나는 감지되지 않은 항목이 0으로 바뀌고 (파일 감지가 첨부 됨) 다른 하나는 모든 값이 0이고 감지되지 않은 항목은 '<'기호가없는 감지 한계로 대체됩니다. (첨부 파일 탐지 불가).
누구든지 데이터 세트에서이 두 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 및 재 포맷안녕 Jim,
나는 이것을 살펴본 결과 작업의 두 번째 부분이 누락되었습니다. 모든 값을 0으로 변경하려면 'Non Detect'에 대한 스크립트가 필요합니다.
루프를 실행하고 값이 0보다 큰 모든 셀을 선택합니다 ( "<0.0"DL 값이있는 셀 제외).
보낸 코드의 마지막 부분은 훌륭하게 작동합니다. '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 및 재 포맷안녕 Jim,
역행 선택을 한 것으로 나타났습니다. 이것이 도움이되지만 문제는 "<0.0"이 포함 된 열만 선택된다는 것입니다. 데이터 세트에서 숫자 데이터가있는 모든 열을 선택하고 변경하려면 어떻게합니까?
도와 주셔서 감사합니다!
Re : 데이터 QA 및 재 포맷더 명확한 경우 사진으로 후속 조치를 취하십시오. 노란색은 교체 된 감지 한계 "<0.0"입니다. 해당 열은 0으로 대체되었지만 나머지는 변경되지 않았습니다.

Re : 데이터 QA 및 재 포맷아, 문제가 보이네요 ..... 아래 문제를 수정했습니다 ..... 믿습니다. 하지만 먼저 무엇인가를 명확히하겠습니다. JMP가 다른 열을 읽을 때 주어진 열에 대한 모든 데이터를 읽고 열이 숫자 또는 문자 열인지 결정합니다. 열의 모든 값은 열이 숫자로 간주 되려면 숫자 값이어야합니다. 따라서 JMP가 숫자가 아닌 셀 (즉 <0.0005)이있는 열을 찾으면 해당 열을 문자 열로 선언합니다. 내 코드는 "<"가 발견 된 열을 코드에서 찾을 수 있다는 점에서이를 활용합니다. 또한 JSL이 Substr ()과 같은 문자 조작 함수를 사용하여 "<"를 제거하고 유효한 숫자를 셀에 남겨 둘 수 있습니다. 그러나 모든 "<"가 제거되면 열을 숫자 열 ...... << 데이터 유형 (numeric)으로 변경할 수 있습니다. 다음은 데이터를 읽은 직후와 "<"열이 처리되기 직전에 숫자로 찾은 모든 열을 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>