[R] print table on plot

David Winsemius dwinsemius at comcast.net
Thu Apr 26 18:32:46 CEST 2012


On Apr 26, 2012, at 9:26 AM, statquant2 wrote:

> Hello,
> I would like to be able to plot an array on a plot, something like:
>        |arg1  | arg2 | arg3
> val1| 0.9    | 1.1    | 2.4
> val2| 0.33  | 0.23 | -1.4
> val3| hello| stop | test
> I know Rwave is good to report but don't want to use it.
>
> ? Is there a package that allow quick and dirty plot of dataframes  
> like this

 > mat=matrix(scan(what="", sep="|"), 4,4)
1:        |arg1  | arg2 | arg3
5: val1| 0.9    | 1.1    | 2.4
9: val2| 0.33  | 0.23 | -1.4
13: val3| hello| stop | test
17:
Read 16 items
 > mat
      [,1]      [,2]       [,3]      [,4]
[1,] "       " "val1"     "val2"    "val3"
[2,] "arg1  "  " 0.9    " " 0.33  " " hello"
[3,] " arg2 "  " 1.1    " " 0.23 "  " stop "
[4,] " arg3"   " 2.4"     " -1.4"   " test"
 > xtable::xtable(mat)
% latex table generated in R 2.14.2 by xtable 1.6-0 package
% Thu Apr 26 12:31:11 2012
\begin{table}[ht]
\begin{center}
\begin{tabular}{rllll}
   \hline
  & 1 & 2 & 3 & 4 \\
   \hline
1 &         & val1 & val2 & val3 \\
   2 & arg1   &  0.9     &  0.33   &  hello \\
   3 &  arg2  &  1.1     &  0.23  &  stop  \\
   4 &  arg3 &  2.4 &  -1.4 &  test \\
    \hline
\end{tabular}
\end{center}
\end{table}


misleading Nabble footer deleted.
-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list