안녕하세요, JMP 커뮤니티 여러분,
열에 저장된 여러 예측 수식을 생성했으며 수식 전체에 공통되는 변수를 평가하기 위해 매개변수를 추출해야 합니다.
dt:Column X << Get Formula를 호출하면 출력은 다음과 같습니다. ~ 아니다 표준 패턴 추출 기능(예: Words(), Munger()...)과 함께 사용할 수 있는 문자열 또는 목록입니다.
질문:
- << Get Formula를 사용하여 수식 매개변수를 수집하는 올바른 함수를 사용하고 있습니까?
- 그렇지 않다면 어떤 기능이 더 적절할까요?
- 그렇다면 << Get 수식 출력을 문자열, 목록 또는 행렬로 변환하는 방법이 있습니까?
도움을 주셔서 감사합니다.
최상의,
TS
여기에 대한 또 다른 접근 방식을 문서화하겠습니다. (덕분에 @바이런_JMP 이에 대한 Arg() 튜토리얼을 참조하세요)
Arg() 명령을 통해 아주 쉽게 작업할 수 있는 목록으로 매개변수를 얻을 수 있습니다. 또한 열 수식에 대한 매개변수를 연관 배열로 반환하는 함수를 아래에 넣었습니다.
// For a given column, col, in a data table, dt, you can get the formula column property with a message:
formula = dt:Col << Get Formula;
// the first argument of which is the parameters list which can be extracted using Arg()
params = Arg(formula, 1);
// from there you can index down to get the parameter / value pair
parameterName1 = Arg(params[1],1);
parameterValue1 = Arg(params[1],2);
그리고 수식 매개변수를 연관 배열로 반환하는 함수
// This function expects a column reference
formulaParameters = Function( {colref},
{default local},
plist = Arg( colref << Get Formula, 1 );
keys = {};
values = {};
For Each( {value, index}, plist,
Insert Into( keys, Arg( value, 1 ) );
Insert Into( values, Arg( value, 2 ) );
);
parameters = Associative Array( keys, values );
);
// Usage example:
dt = Current Data Table();
columnWithParameters = dt:Col1 << Get Column Reference();
parameterAArray = formulaParameters( columnWithParameters );수식 내부의 변수 이름에 관심이 있는 경우 수식 표현식을 직접 사용하는 것이 더 쉬울 수 있습니다. 다음은 수식에서 고유한 기호 이름을 추출하는 예입니다.
dt = open("$sample_data/Reliability/Locomotive.jmp");
ex = column(dt, 3)<<GETFORMULA></GETFORMULA>꽤 "Old School"이므로 수식을 문자열로 검색하여 처리합니다.
Names Default To Here( 1 );
dt = Current Data Table();
x = Char( dt:predicted height << get formula );