4

I have a vector of values, and I want to use the output of "summary" in LaTeX. I understand that xtable is designed for exactly that purpose.

However ...

> values <- c(1,2,3)
> summary(values)
Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
1.0     1.5     2.0     2.0     2.5     3.0 
> xtable(summary(values))
Error in xtable.table(summary(values)) : 
  xtable.table is not implemented for tables of > 2 dimensions

What am I doing wrong here?

Werner
  • 603,163
bonifaz
  • 395

2 Answers2

0

I think it's because xtable would be happier if you were summarising a dataframe rather than a vector. Try this instead:

values <- c(1,2,3)
values <- data.frame(x=values)
xtable(summary(values))
Nicholas
  • 386
-1

xtable(data.frame(summary(values[1:6])))
Werner
  • 603,163
  • 2
    Welcome to TeX.SX! The answer would be improved by adding some explanation or a reference to where there is relevant documentation. – Andrew Swann Sep 18 '14 at 14:02