Hey,
I am trying to run a for loop to categorize several columns of data. Out of the 3 or 4 columns, the column with the highest value dictates a category for that entire row. I tried using this formula in a new column to no avail. For reference I am using a subset of data that I later saved as it's own individual file.
For( i = 1, i < N Row( :Linked Subset ), i++, If( :Linked Subset[i][5] > :Linked Subset[i][3], :Label = "Hormone", If( :Linked Subset[i][4] > :Linked Subset[i][3] & :Linked Subset[i][6] > :Linked Subset[i][3], :Label = "ImmunoChemo", If( :Linked Subset[i][4] > :Linked Subset[i][3], :Label = "Chemo", If( :Linked Subset[i][6] > :Linked Subset[i][3], :Label = "Immuno", :Label = "None" ) ) ) ) )
I then tried running this script instead
dt = Open( "~/One Drive/Work/Research/Exported CSV/Subset.jmp" );
For( i = 1, i < N Row( :Linked Subset ), i++,
If( :Linked Subset[i][5] > :Linked Subset[i][3],
:Label = "Hormone",
If( :Linked Subset[i][4] > :Linked Subset[i][3] & :Linked Subset[i][6] > :Linked Subset[i][3],
:Label = "ImmunoChemo",
If( :Linked Subset[i][4] > :Linked Subset[i][3],
:Label = "Chemo",
If( :Linked Subset[i][6] > :Linked Subset[i][3],
:Label = "Immuno",
:Label = "None"
Any help as to why the script or formula isnt working is much appreciated. I admit, I was a bit lost when trying to write the script, so I think it is a bit far off from what it should be. I linked the file but I had to remove the first column of the data table for privacy issues.
Thanks