printing matrices and vectors side by side
<p>For tutorial purposes, I'd like to be able to print or display matrices and vectors side-by-side, often to illustrate the result of a matrix equation, like $A x = b$.</p>

<p>I could do this using SAS/IML, where the <code>print</code> statement takes an arbitrary collection of (space separated) expressions, evaluates them and prints the result, e.g., </p>

<pre><code>print A ' * ' x '=' (A * x) '=' b;

                    A                     X   #TEM1001       B
                    1     1    -4  *  0.733 =        2 =     2
                    1    -2     1     -0.33          1       1
                    1     1     1      -0.4          0       0
</code></pre>

<p>Note that quoted strings are printed as is.</p>

<p>I've searched, but can find nothing like this in R.  I imagine something like this could be done by a function <code>showObj(object, ...)</code> taking its list of arguments, formatting each to a block of characters, and joining them side-by-side.</p>

<p>Another use of this would be a compact way of displaying a 3D array as the side-by-side collection of its slices.</p>

<p>Does this ring a bell or does anyone have a suggestion for getting started?</p>