예를 들어, 제가 가지고 있는 몇 가지 함수를 조금 더 재사용 가능하게 만들고 싶습니다. 데이터 세트의 특정 열이 있는 요약 표를 만들고 있습니다. "GetExperimentsSummary"와 "GetCompoundsSummary" 대신 하나의 "GetSummary" 함수를 사용할 수 있도록 열 목록을 인수로 전달하고 싶지만, 이것들은 열의 개수가 다르기 때문에 열 목록을 별도로 패키징해야 합니다(아마도 제 클래스 정의에서). 그런 다음 하나의 인수로 함수에 전달해야 합니다. 이것이 jsl에서 가능할까요? 구문은 어떻게 될까요? 아래에 제 get experiments와 get compound의 예가 있고, 저는 JMP18을 사용하고 있습니다.
//Get Experiments function
getexperimentssummary = function ({},
original_data << Summary(
Group(
:ExperimentID, :Read Date, :Experiment Type, :Plate Size, :Plate Type,
:Dispense Mode, :Probook Number, :Probook Page Number, :Experiment Notes
),
Freq( "None" ),
Weight( "None" ),
output table name("Experiment_summary")
);
experiment_summary = Data Table ("Experiment_summary");
experiment_id = "ExperimentID";
);
//Get Compounds Summary
getcompoundssummary = Function( {},
original_data << Summary(
Group(
:CompoundID, :Compound, :Compound Lot Number, :Compound Supplier, :Compound Catalog Number
),
Freq( "None" ),
Weight( "None" ),
output table name("Compound_summary")
);
compound_summary = Data Table ("Compound_summary");
Compound_ID = "CompoundID";
);
이런 것을 찾고 계신가요?
Names Default To Here(1);
dt = open("$SAMPLE_DATA/Big Class.jmp");
get_summary = function({dt, collist}, {Default Local},
dt_summary = dt << Summary(
Group(Eval(collist)),
Freq("None"),
Weight("None"),
Link to original data table(0),
output table name((dt << get name) ||" Summary")
);
return(dt_summary);
);
dt_summary1 = get_summary(dt, {"sex"});
dt_summary2 = get_summary(dt, {"sex", "age"});