Hi JMP Community,
I have a list of column headers (17 capture probes) and depending on the data, a particular data set may have any number of those 17 capture probes.
I need to create a script where the stack function will stack columns that exist in the data set and ignore any other columns that are missing.
I pulled the source script for one particular data set and tried to place an if() statement with a loop in order to try and accomplish this, but it's still not working because certain columns were not found.
I've included the script that I have now.
dt = Current Data Table();
text_col_list =
{"SP1_A","SP12_B","SP35_A","SP37_A","SP5_A","SP7_A","SP2_A","SP39_A","SP38_A","SP41_A","SP40_A","SP42_A","SP3_A","SP4_A","SP6_A","SP10_A","SP11_A"};
jmp_col_list =
{"cSCR1","CP 34","CP 24 v.6.3","CP 34 v.1","CP 24 v.1","CP 44 v.1","CP 24","CP24 v.14
","CP24 v.13","CP24 v.16","CP24 v.15","CP24 v.17","CP 26","CP 44","CP 24 v.10","CP 32","CP 33"};
col_name_list = dt << get column names(string);
for (i = 1, i <= nitems(text_col_list), i++,
if (contains(col_name_list, text_col_list[i]),
column(dt, text_col_list[i]) << set name(jmp_col_list[i]);
);
);
dt = Current Data Table();
jmp_col_list =
{"cSCR1","CP 34","CP 24 v.6.3","CP 34 v.1","CP 24 v.1","CP 44 v.1","CP 24","CP24 v.14
","CP24 v.13","CP24 v.16","CP24 v.15","CP24 v.17","CP 26","CP 44","CP 24 v.10","CP 32","CP 33"};
col_name_list = dt << get column names(string);
for (i = 1, i <= nitems(jmp_col_list), i++,
if (contains(col_name_list, jmp_col_list[i]),
<< Stack(columns(jmp_col_list),
<<ignore errors(true)),
Source Label Column( "Capture Probes" ),
Stacked Data Column( "Intensity" ),
Name( "Non-stacked columns" )(Keep(
:Filename,
:Condition,
:Rep #,
:Name( "Time (s)" ),
:Name( "Date/Time" ),
:Cartridge #
))
));