Spero di rendere alcune funzioni che ho un po' più riutilizzabili, ad esempio sto creando una tabella di riepilogo con colonne specifiche dal mio set di dati. Vorrei passare l'elenco delle colonne come argomento per consentirmi di avere una funzione "GetSummary" anziché "GetExperimentsSummary" e "GetCompoundsSummary", ma poiché queste necessitano di numeri diversi di colonne, devo essere in grado di impacchettare l'elenco delle colonne separatamente (molto probabilmente nella definizione della mia classe) e quindi passarle alla funzione come un argomento. È possibile in jsl? Quale sarebbe la sintassi? Esempi dei miei esperimenti get e composti get di seguito, e sono su 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";
);
Stai cercando qualcosa del genere?
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"});