셀 값 삭제안녕하세요,
아래와 같은 비슷한 테이블이 있습니다.
1. 테이블에 숫자 열 x_1, x_2, x3, ...이 있습니다.
2. 열 x_1, x_2, x_3, ...의 모든 행에서 특정 값(예: 8)을 삭제하고 싶습니다. (필요한 o/p 테이블도 아래에 나와 있습니다.)
입력 테이블
| ㅏ |
비 |
씨 |
x_1 |
x_2 |
x_3 |
x_4 |
x_5 |
x_6 |
이자형 |
| |
|
|
1 |
8 |
2 |
7 |
2 |
2 |
|
| |
|
|
2 |
8 |
8 |
8 |
8 |
8 |
|
| |
|
|
8 |
8 |
2 |
5 |
삼 |
8 |
|
필수 출력 테이블
| ㅏ |
비 |
씨 |
x_1 |
x_2 |
x_3 |
x_4 |
x_5 |
x_6 |
이자형 |
| |
|
|
1 |
. |
2 |
7 |
2 |
2 |
|
| |
|
|
2 |
. |
. |
. |
. |
. |
|
| |
|
|
. |
. |
2 |
5 |
삼 |
. |
|
내 스크립트가 첨부되어 있습니다 ...
도움/피드백에 미리 감사드립니다 
dt = Current Data Table ();
for (i=1, i<=6, i++, //iterate through columns loop
temp = "x_" || char (i); //column name
dt << Go To (temp); //select column
dt << Select Where (temp==8);// Select rows where value is 8 ***PROBLEM*** Not selecting rows :(
//After selecting rows where value is 8 for a specific column, I want to delect the value...May be use Empty() ??
);
Re: 셀 값 삭제다음은 원하는 작업을 수행할 이전 스크립트에 대한 아주 작은 변경 사항입니다.
names default to here(1);
dt = open("$SAMPLE_DATA/Big Class.jmp");
// set some height rows to missing
dt:height[6] = .;
dt:height[14] = .;
r = loc(ismissing(dt[0, 4]));
// set the values in column 5(wieght) to missing
// for the rows found(located) in column 4
dt[r, 5] = .;Re: 셀 값 삭제흥미로운.나는 이와 같은 것에 대해 약간 다른 요구를 가지고 있습니다.
A열과 B열이 2개 있다고 합시다.A에는 날짜/시간이 있고 B에는 키 값이 있습니다.날짜/시간이 누락되었지만 열 B에 키가 있는 줄이 있습니다.
날짜/시간이 누락된 경우 키 값을 삭제하려면 어떻게 해야 합니까?
Re: 셀 값 삭제상황에 더 빠른 경우를 대비하여 데이터 테이블 첨자화도 옵션입니다.
dt = open("$SAMPLE_DATA/Big Class.jmp");
r = loc(dt[0, 4]==61)
dt[r, 4] = .;Re: 셀 값 삭제정말 감사합니다!
루프를 사용하여 반복적으로 행에 액세스한 다음 변경하려고 생각했지만 JSL을 사용하는 아주 좋은 방법입니다. 
<SPAN class="token function">Column</SPAN><SPAN class="token punctuation">(</SPAN> dt<SPAN class="token punctuation">,</SPAN> ColList<SPAN class="token punctuation">[</SPAN>i<SPAN class="token punctuation">]</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">[</SPAN>dt <SPAN class="token operator"><</SPAN><SPAN class="token operator"><</SPAN> get rows where<SPAN class="token punctuation">(</SPAN> <SPAN class="token function">As Column</SPAN><SPAN class="token punctuation">(</SPAN> dt<SPAN class="token punctuation">,</SPAN> ColList<SPAN class="token punctuation">[</SPAN>i<SPAN class="token punctuation">]</SPAN> <SPAN class="token punctuation">)</SPAN> <SPAN class="token operator">==</SPAN> <SPAN class="token number">8</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">]</SPAN> <SPAN class="token operator">=</SPAN> <SPAN class="token punctuation">.</SPAN><SPAN class="token punctuation">;</SPAN>
Re: 셀 값 삭제문제에 올바르게 접근하고 있으며 구문 문제가 있습니다.아래는 코드의 작동 버전입니다.
Names Default To Here( 1 );
dt = Current Data Table();
// Select the columns to be evaluated
// ColList = {"x_1","x_2","x_3","x_4","x_5","x_6"};
// or if there is a programmatic way to get the list,
// do something like below
ColList = dt << get column names( numeric, string );
// Loop backwards through the list so the "i" index
// maintains it's proper reference
For( i = N Items( ColList ), i >= 1, i--,
If( Left( ColList[i], 2 ) != "x_",
ColList = Remove( ColList, i, 1 )
)
);
// Loop across ColList and set the values qualified
// values to missing
For( i = 1, i <= N Items( ColList ), i++,
// The line below takes advantage of a JMP feature where
// you can change specific values in a column in one statement
// by just using a matrix of the rows you want to change
// Column A[5,6,9,22] = 4;
// This would set a column named "Column A"'s rows 5,6,9 and 22
// to the value of 4
// In your case, you want to eliminate the cell value, so the
// line sets the value to a missing value, which in JMP is "."
Column( dt, ColList[i] )[dt << get rows where( As Column( dt, ColList[i] ) == 8 )] = .;
);