문제
동일한 새로운 수식 기반 열 세트를 데이터에 계속해서 추가하려고 합니다.
Solution
수식과 열 이름을 테이블에 저장합니다. 해당 테이블에서 추출하십시오. 대상 데이터 테이블의 각 쌍에 대해 새 열을 만들려고 반복합니다.
favorite_formulas=function({dt1=currentdatatable(),FFpath},{default local},
/*
adds formulas to a data table from another data table <BR />used to store column names and respective formulas
example: favorite_formulas(currentdatatable(),"my_formulas.jmp");
FFpath must point to a file with columns "formula" and "colname" <BR />with text of desired formulas and column names
in the order they should evaluate (row 3 can use the column created by row 2, etc)
*/
try( //open setup file and get list of formulas and column names
dtFF=open(FFpath);
current data table(dtFF);
dt1 << suppressFormulaEval(true);
try(c=:colname,<BR /> wait(0);statusmsg("setup file must contain column colname");<BR /> throw ("setup file must contain column colname"));
try(c=:formula,<BR /> wait(0);statusmsg("setup file must contain column formula");<BR /> throw("setup file must contain column formula"));
CN=column("colname")<<GETVALUES></GETVALUES>Discussion<P>나는 종종 동일한 열과 형식으로 데이터를 가져오고 매번 동일한 새 수식 열 세트를 추가하고 싶습니다. 이것은 이를 쉽게 만들고 다른 사용자와 간단하고 읽기 쉬운 데이터 테이블로 "좋아하는 공식" 세트를 쉽게 공유할 수 있게 해주는 간단한 정보입니다. 나는 이 함수 버전을 다른 많은 스크립트 내에서 사용하지만 추가 기능 버전도 있습니다.</P><BR />See Also<P> </P>
이 기능은 JMP Pro에서 사용할 수 있는 Formula Depot에서 직접 지원됩니다. "열에서 수식 추가"를 사용하여 테이블의 수식을 저장소에 저장하고 나중에 "스크립트 실행"을 사용하여 새 테이블로 전송합니다.
