JMP 테이블에서 두 번째로 큰 숫자를 추출하려고 했습니다. 지금까지는 수동으로 만 사용했습니다.
내림차순 정렬( Eval List( {:X1, :X2, :X3}));
개별 열 이름이 아닌 전체 테이블을 어떻게 전달할 수 있습니까?

IF() 함수의 비교 구성 요소에 논리 문제가 있습니다.
If( (Abs( colMax )) > 300 | (Abs( colMax )) > 250
값이 250보다 크면 비교가 참이 되므로 >300은 필요하지 않습니다.
비교는 다음과 같기만 하면 됩니다.
If( ( Abs( colMax ) > 250,
193의 값을 얻는 이유를 묻습니다.출력되는 값이 열에 대해 두 번째로 높은 값이고 필터링이 열의 최대값을 기반으로 하기 때문입니다.두 번째로 높은 값은 임의의 값일 수 있습니다.열에 다음 값이 있는 경우
최대 열 값은 600이므로 Max Col() > 250의 IF() 절을 전달하고 열에서 두 번째로 높은 값은 193입니다.
"에 대한 귀하의 질문에 대해 두 번째로 높은 값, 즉 colSecondMaxValues의 행 번호를 어떻게 찾을 수 있습니까?", 이를 수행하는 방법은 이미 스크립트에 있습니다.성명
maxRows = dt << get rows where( As Column( dt, colNamesList[i] ) == colMax );
열에 최대값이 있는 행에 대한 행 번호의 행렬을 반환합니다.두 번째로 높은 값에 대한 행 번호를 원하면 두 번째 최대 값과 동일한 행을 가져오기만 하면 됩니다.따라서 Insert Into() 함수 뒤에 이 문을 추가하면 두 번째로 높은 값을 가진 행을 얻게 됩니다.
Show(
dt << get rows where(
As Column( dt, colNamesList[i] ) == Col Max( Column( dt, colNamesList[i] ) )
)
);
전체 코드는 다음과 같습니다.
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );
colNamesList = dt << get column names( string, continuous, numeric );
colSecondMaxValues = {};
// Loop across all continuous columns and find the Max value in
// a column, delete that value, and then find the second max value
// finally, replace the old values, and save the results
For( i = 1, i <= N Items( colNamesList ), i++,
colMax = Col Max( Column( dt, colNamesList[i] ) );
If( Abs( colMax ) > 250,
maxRows = dt << get rows where( As Column( dt, colNamesList[i] ) == colMax );
Show( maxRows );
Column( dt, colNamesList[i] )[maxRows] = .;
Insert Into( colSecondMaxValues, Col Max( Column( dt, colNamesList[i] ) ) );
Show(
dt << get rows where(
As Column( dt, colNamesList[i] ) == Col Max( Column( dt, colNamesList[i] ) )
)
);
Show( colSecondMaxValues );
Column( dt, colNamesList[i] )[maxRows] = colMax;
);
);@ih 죄송하지만 전체 테이블이 아니라 모든 열의 값이 필요합니다.
@txnelson 스크립트 주셔서 감사합니다. 이 스크립트에 대해 300 또는 250보다 큰 조건이 작동하도록 하려고 하는데 왜 여전히 193과 같은 값을 사용하는지 이해할 수 없습니다. 또한 colSecondMaxValues와 같이 두 번째로 높은 값의 행 번호를 어떻게 찾을 수 있습니까? 당신의 도움을 주셔서 대단히 감사합니다.
dt=open("$SAMPLE_DATA/semiconductor capability.jmp");
colNamesList= dt<<GET column="" names=""> 300 | (abs(colMax)) > 250,
maxRows = dt<<GET rows="" where=""></GET></GET>전체 테이블에서 두 번째로 큰 값을 원하는 경우 열에 관계없이 다음을 수행하십시오.
Names default to here(1);
dt = open( "$SAMPLE_DATA/semiconductor capability.jmp" );
//Find the two largest values in the entire table
Sort Descending(Shape(dt << Get all columns as matrix(),1))[{1, 2}];
//Or, to exclude character columns
Sort Descending(Shape(dt << Get as matrix(dt << get column names(numeric)),1))[{1, 2}];다음은 데이터 테이블의 모든 연속 열에서 두 번째로 높은 값을 결정하는 작은 스크립트입니다.
names default to here(1);
dt=open("$SAMPLE_DATA/semiconductor capability.jmp");
colNamesList= dt<<GET column="" names=""></GET>