table transpose

Prev Next

Function Names

table transpose

Description

This functions rarranges table contents from horizontal orientation to vertical orientatio. All prior row headers will move to the 1st column. On the other hand, all data in the 1st column become headers. Attention: Configuration settings applied wtih table configure() prior to this call will be discarded because the transposed table is actually a new table.

Call as: procedure

Restrictions

Indirect parameter passing is disabled

Parameter count

1-2

Parameters

No.TypeDescription
1.
input
string Name of existing table

If only the 1st function parameter is provided, then this table will be transposed. If another table is named in the 2nd function parameter, then this table remains unchanged.

Opt. 2.
input
string Name of new table

Examples

  table initialize( t,
       { { Food,     color,          taste,     best with },
         { Fries,    golden yellow,  salty,     hamburger },
         { Pizza,    colorful,       tasteful },
         { Chianti,  rubin red,      bitter,    pasta, worth enjoying },
         { Tirami sù,crème and brown,sweet } } );

  table transpose ( t );
  table list ( t );

Output

    0 : Food      | Fries         | Pizza    | Chianti        | Tirami sù      
    1 : color     | golden yellow | colorful | rubin red      | crème and brown
    2 : taste     | salty         | tasteful | bitter         | sweet          
    3 : best with | hamburger     |          | pasta          |                
    4 :           |               |          | worth enjoying |                

Try it yourself: Open LIB_Function_table_transpose.b4p in B4P_Examples.zip. Decompress before use.