안녕. JSL의 일부 배포 플랫폼 옵션(예: Outlier Box Plot, Normal Quantile Plot 등)을 수정하는 데 문제가 있습니다. 사용자가 임의의 열 목록에 대한 분포를 만들 수 있도록 하는 스크립트를 작성하고 있습니다. 또한 사용자가 모든 플롯에 대해 Outlier Box Plots 또는 Normal Quantile Plots를 사용할지 여부를 지정할 수 있는 기능을 제공하고 싶습니다. 그래도 몇 가지 문제가 있고 누군가 통찰력을 제공할 수 있기를 바랍니다.
기록을 위해 Mac에서 JMP Pro 14.3.0을 실행하고 있습니다.
먼저 나는 이것을 시도했다 :
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
tcol_lis = {"height", "weight"};
//First approach
nqplopt = 1; //This is meant to turn on the Normal Quantile Plot option
Distribution(
Column(EvalList(tcol_lis)),
Normal Quantile Plot(nqplopt),
);
nqplopt = 0; //But it has no effect
Distribution(
Column(EvalList(tcol_lis)),
Normal Quantile Plot(nqplopt),
);작동했어야 하는 것처럼 보이지만 "nqplopt"를 1 또는 0으로 설정해도 아무런 효과가 없습니다. 제 경우에는 Quantile 플롯이 두 번 모두 생성되었습니다. 내 환경 설정에서 해당 옵션이 꺼져 있기 때문에 흥미 롭습니다.
다음으로 대신 생성 후 배포판에 메시지를 보내 보았습니다.
//Second approach - send the Normal Quantile option as a message
nqplopt = 1;
dist = Distribution(
Column(EvalList(tcol_lis))
);
dist << Normal Quantile Plot(nqplopt);
nqplopt = 0;
dist = Distribution(
Column(EvalList(tcol_lis))
);
dist << Normal Quantile Plot(nqplopt); //No difference from when nqplopt = 1
이전과 마찬가지로 nqplopt가 1 또는 0일 때 차이가 없습니다. 개체 "dist"가 여러 분포를 참조하고 JSL이 메시지 전송을 처리하는 방법을 잘 모르겠습니다.
마지막으로 이동 솔루션으로 이동하여 JSL 견적을 사용하여 원하는 대체를 강제 실행했습니다.
//Third approach - make substitutions via JSL Quote
nqplopt = 0;
dist_jst = JSL Quote(
Distribution(
Column(EvalList(tcol_lis)),
Normal Quantile Plot(nqplopt_ph),
);
);
SubstituteInto(dist_jst,
Expr(nqplopt_ph), nqplopt
);
Show(dist_jst); //The "nqplopt_ph" remains unchanged for some reason.
Eval(Parse(dist_jst)); //Dist. created with a Normal Quantile Plot, as if nqplopt = 1
그래도 실직한 사기꾼처럼 주사위는 없습니다. 수정된 dist_jst 문자열을 표시하면 SubstituteInto 명령이 실행되지 않은 것처럼 보입니다. 왜 그런지 궁금합니다. 이전에 JSL Quote를 여러 번 사용했지만 이렇게 수정할 수 없는 이유를 이해할 수 없습니까?
생각이나 해결 방법이 있습니까?
@nikles ,
귀사에 적합한 솔루션을 찾으신 것을 축하드립니다.아래는 대안입니다.
EvalExpr()은 각 Expr(변수)를 해당 값으로 바꾸고 값이 포함된 표현식을 반환합니다.따라서 Eval( EvalExpr() )은 변수를 값으로 바꾸고 결과 식을 실행합니다.참고 Ignore Platform Preferences(1)를 추가하고 주석 처리했습니다. 사용자가 스크립터와 기본 설정이 다른 경우 보고서가 동일하지 않을 수 있습니다. Ignore Platform Preferences(1)는 이 분석에 대한 모든 기본 설정을 해제하므로 스크립터는 표시되어야 하는 모든 항목을 지정해야 합니다.그러나 사용자가 다른 사용자와 동일한 분석을 볼 수 있도록 보장합니다.
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
tcol_lis = {"height", "weight"};
//First approach
nqplopt = 1; //This is meant to turn on the Normal Quantile Plot option
Eval(EvalExpr(Distribution( //Ignore Platform Preferences(1),
Column( EvalList(tcol_lis)),
Normal Quantile Plot(nqplopt),
)));
nqplopt = 0; //But it has no effect
Eval( Eval Expr(Distribution(//Ignore Platform Preferences(1),
Column(EvalList(tcol_lis)),
Normal Quantile Plot(Expr(nqplopt)),
)) );
글쎄요... 제 질문에 대한 답을 생각해냈을 수도 있습니다. JSL Quote 경로가 작동하지 않는 이유가 여전히 궁금하지만 제가 채택한 솔루션은 리터럴 인용 문자열을 대신 사용하는 것이었습니다. 여기에 표시된 대로:
//Fourth approach - make substitutions via a literal string quote
nqplopt = 0;
dist_str =
"Distribution(
Column(EvalList(tcol_lis)),
Normal Quantile Plot(nqplopt_ph),
)";
SubstituteInto(dist_str,
"nqplopt_ph", Char(nqplopt)
);
Show(dist_str); //The "nqplopt_ph" is successfully changed to 0.
Eval(Parse(dist_jst)); //Finally, it works.
나는 이것이 일반적으로 "좋은 습관"(전체 명령을 따옴표로 묶음)으로 간주되지 않는다고 들었지만 meh ... 작동합니다.