According to this is the data table given below:
| | Row | A | B | C | D |
| 1 | A | 1 | 0.02 | 0.8 | -0.6 |
| 2 | B | 0.02 | 1 | 0.7 | -0.02 |
| 3 | C | 0.8 | 0.7 | 1 | 0.51 |
| 4 | D | -0.6 | -0.02 | 0.51 | 1 |
I'm supposed to create another data table that gives the following: Corresponding Row, Corresponding Column as given in Column 1 and its value. May I ask if I should create a matrix or just do need to edit from the data table? Any help is appreciated, thank you. (Below is a result from the first data table above, except that I have to do it for 2,000+ rows now.)
| | Corresponding Rows | Corresponding Columns | >=0.05 && < 1 |
| 1 | A | C | 0.8 |
| 2 | B | C | 0.7 |
| 3 | C | A | 0.8 |
| 4 | C | B | 0.51 |
| 5 | C | D | 0.51 |
| 6 | D | C | 0.51 |
Building on @ron_horne example, here is a complete piece of code that will work on the sample data table, or on the 2000x2000 data table you mentioned
dt = current data table ();
cols = dt << Get Column Names( Continuous );
dtStack = dt << Stack(
columns( cols ),
Source Label Column( "Coresponding Columns" ),
Stacked Data Column( ">=0.05&&<1" )
);
dtStack:Row << set name("Corresponding Rows");
dtStack << select where( dtStack:Name(">=0.05&&<1") < .05 | dtStack:Name(">=0.05&&<1")>=1);
dtStack << delete rows;
Hi @reallyneedhelp ,
let me know if the following scripts brings you any closer to your target.
dt = current data table ();
cols = dt << Get Column Names( Continuous );
dt << Stack(
columns( cols ),
Source Label Column( "Column" ),
Stacked Data Column( "Data" )
);
Ron
Hi @reallyneedhelp,
perhaps this quick Stack option will do the Job.
go to Tables>>stack. from there you can follow the pictures


you can also follow this script. once you have the table run the "Stack" script from the top left hand side.
New Table( "Untitled",
Add Rows( 4 ),
New Script(
"Stack",
Data Table( "Untitled" ) << Stack(
columns( :A, :B, :C, :D</img> ),
Source Label Column( "Column" ),
Stacked Data Column( "Data" )
)
),
New Column( "Row", Character, Nominal, Set Values( {"A", "B", "C", "D"} ) ),
New Column( "A",
Numeric,
Continuous,
Format( "Best", 12 ),
Set Values( [1, 0.02, 0.8, -0.6] )
),
New Column( "B",
Numeric,
Continuous,
Format( "Best", 12 ),
Set Values( [0.02, 1, 0.7, -0.02] )
),
New Column( "C",
Numeric,
Continuous,
Format( "Best", 12 ),
Set Values( [0.8, 0.7, 1, 0.51] )
),
New Column( "D",
Numeric,
Continuous,
Format( "Best", 12 ),
Set Values( [-0.6, -0.02, 0.51, 1] )
)
)
let us know if this is what you are looking for.
Ron