<doc>
  <legacy_id>1597</legacy_id>
  <name>transpose</name>
  <type>function</type>
  <syntax>
    <example>transpose(<i>array</i>)</example>
  </syntax>
  <library></library>
  <objects>
  </objects>
  <synonyms>
  </synonyms>
  <classification>
    <category>Values &amp; Properties</category>
  </classification>
  <references>
    <function tag="keys">keys Function</function>
    <function tag="matrixMultiply">matrixMultiply Function</function>
  </references>
  <history>
    <introduced version="1.1">Added.</introduced>
  </history>
  <platforms>
    <mac/>
    <windows/>
    <linux/>
    <ios/>
    <android/>
  </platforms>
  <classes>
    <desktop/>
    <server/>
    <web/>
    <mobile/>
  </classes>
  <security>
  </security>
  <summary><glossary tag="return">Returns</glossary> a two-dimensional <glossary tag="array">array</glossary> after swapping the order of <function tag="keys">keys</function> for each <keyword tag="element">element</keyword> of the <glossary tag="array">array</glossary>.</summary>
  <examples>
    <example>transpose(myArray)</example>
    <example>put transpose(censusByHousehold) into censusByGroup</example>
  </examples>
  <description>
    <p>Use the <b>transpose</b> <control_st tag="function">function</control_st> to swap rows and columns in a matrix.</p><p/><p><b>Parameters:</b></p><p>The <i>array</i> is a two-dimensional <glossary tag="array">array</glossary> <glossary tag="variable">variable</glossary> whose <glossary tag="element">elements</glossary> are numbers, and whose keys are sequential numbers.</p><p/><p><b>Value:</b></p><p>The <b>transpose</b> function <glossary tag="return">returns</glossary> an <glossary tag="array">array</glossary>.</p><p/><p><b>Comments:</b></p><p>A two-dimensional array is an array whose elements have a two-part key to describe them. You can visualize such an array as a set of rows and columns: the first part of each element's key is the row number, and the second part is the column number. For example, the expression<code> myArray[3,2] </code>describes the element of<code> myArray </code>which is in the third row, second column.</p><p/><p>The <b>transpose</b> <control_st tag="function">function</control_st> simply swaps rows for columns. In other words, for each <keyword tag="element">element</keyword> in the <i>array</i>, the corresponding <keyword tag="element">element</keyword> in<code> transpose(<i>array</i>) </code>has its two parts switched one for the other. The value in the third row, second column is moved to the second row, third column.</p><p/><p>The <b>transpose</b> <control_st tag="function">function</control_st> is its own <keyword tag="inverse">inverse</keyword>: you can transpose a transposed array again to recover the original array.</p><p/><p><code/><img src="202653"/> <b>Important </b><code/> If the <glossary tag="array">array</glossary> has missing <glossary tag="element">elements</glossary>, the <function tag="transpose">transpose</function> <control_st tag="function">function</control_st> will fail to work. For example, an <glossary tag="array">array</glossary> that contains <glossary tag="element">elements</glossary> <code>myArray[1,1]</code>,<code> myArray[1,2]</code>, and<code> myArray[2,2] </code>cannot be transposed because the element<code> myArray[2,1] </code><a/>is missing.</p>
  </description>
</doc>