Subscribe Bookmark RSS Feed

How can I force a subset data table into a single element list?

mikedriscoll

Community Trekker

Joined:

Jun 23, 2011

Hi,

I have an existing script that can plot outputs by user selected grouping variables.  There are several actions taken by the script, and the typical case is there is more than one group in the grouping variable.  I've noticed my script throws an error when the number of groups equals 1, and this is because when i subset the data table by group, the variable containing the subset data table is no longer a list, even though it was previously declared as a list. If there are 2 or more groups, the list is maintained.  I could programmatically account for this, but its kind of a long script and i was hoping to force it as a list.  Is this possible? Example attached.

I'm using JMP 10.

Thanks,
Mike

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

In JMP 10 you could add the following logic to convert it back to a list:

if (type(mytablelist1) == "Table",

    tmp_list = {};

    insertinto(tmp_list, mytablelist1);

    mytablelist1 = tmp_list;

);

3 REPLIES
Byron_JMP

Staff

Joined:

Apr 26, 2012

Although this isn't necessarily a convenient answer, in JMP11 this doesn't seem to be an issue and the script runs completely.

Log looks good too:

myTableList1 = {DataTable("Subset of Crops")};

myTableList2 = {DataTable("Subset of Crops 1"), DataTable("Subset of Crops 2")};

Solution

In JMP 10 you could add the following logic to convert it back to a list:

if (type(mytablelist1) == "Table",

    tmp_list = {};

    insertinto(tmp_list, mytablelist1);

    mytablelist1 = tmp_list;

);

mikedriscoll

Community Trekker

Joined:

Jun 23, 2011

Thanks PMRoz & Byron for your help.

-Mike