함수의 동적 열 참조여보세요,
특정 열의 행을 참조하는 함수를 작성하여 모든 열 이름에서 실행할 수있는 동적으로 만들려고합니다. Big Class 테이블을 샘플로 사용하여 높이 열에 대한 계산을 실행하려고했지만 함수에서 하드 코드되지 않은 한 작동하지 못했습니다. 또한 지연 기능이 기능 내에서 작동하지 않는 것 같습니다.
이것은 내가 가지고있는 스크립트입니다.
dt = 열다 ( "$ SAMPLE_DATA / Big Class.jmp" );
Row () = 4;
ii = 4 ;
시험 = 기능 ({꼬리표},
Y = tag [ii] - tag [ii- 1 ]; // 작동하지 않는다.
// Y = 높이 [ii] - 높이 [ii-1]; 이 작품
X = 지연 (꼬리표, 1 ); // 작동하지 않는다.
// X = 지연 (높이, 1); 이 작품
);
테스트 (높이)
미리 감사드립니다.
제목 : Re : 함수의 동적 열 참조아래 주석 달린 스크립트보기
t = Open( "$SAMPLE_DATA/Big Class.jmp" );
Row() = 4;
ii = 4;
Test = Function({tag},
Y = column(t,tag)[ii] - column(t,tag)[ii-1]; // this doesn't work
//Y = height[ii] - height[ii-1]; this works
X = lag(column(t,tag)[ii],1); // this doesn't work
//X = lag(height,1); this works
// If you want the calculated values to be returned to a value such as calling the function
// rr = Test("Height")
// uncomment the code below
//YXList = {};
//insert into(YXList,Y);
//insert into(YXList,X);
//return(YXList);
);
// If you specify
// Test(height);
// JMP will look for the value of a variable called height
// You need to pass the column name as a string and have the
// function process it
Test("height")제목 : Re : 함수의 동적 열 참조지금 나는 그것을 얻었다 중대하다.
매우 감사합니다! 정말 감사합니다.