Re: [R] 2 problems with latex.table (quantreg package) - reproducible

From: roger koenker <>
Date: Wed 10 Jan 2007 - 18:47:26 GMT

The usual R-help etiquette recommends:

  1. questions about packages go to the maintainer, not to R-help.
  2. examples should be reproducible: ie self contained.

if you look carefully at the function latex.summary.rqs you will see that there is a failure to pass the argument "..." on to latex.table. This
_may_ be the source of your problem if in fact your v1 and v2 were summary.rqs objects, but I doubt that they are.

You might try caption = "". More generally there are much improved latex tools elsewhere in R; if you aren't making tables that are specific
to quantreg, you might want to use them.

url:            Roger Koenker
email            Department of Economics
vox:     217-333-4558                University of Illinois
fax:       217-244-6678                Champaign, IL 61820

On Jan 10, 2007, at 12:23 PM, Kati Schweitzer wrote:

> Dear all,
> When using latex.table from the quantreg package, I don't seem to
> be able to set
> table.env=FALSE: when I don't specify caption (as I think I should,
> when
> understanding the R help rightly(?)), I get an error message, and
> when I
> do so, of course I get one, as well.
> The funny thing is, that a table is indeed produced in the first case,
> so I get a nice tabular, but as I'm using the command within a for -
> loop, the loop stops due to the error and only one latex table is
> produced.
> Example R-Code:
> library(quantreg)
> v1 <- c("val1","val1","val2")
> v2 <- c("val1","val2","val2")
> tab <- table(v1,v2)
> latex.table(tab,table.env=FALSE)
> #error - german R error message (saying that caption is missing and
> has no default :-) ):
> #Fehler in cat(caption, "\n", file = fi, append = TRUE) :
> # Argument "caption" fehlt (ohne Standardwert)
> latex.table(tab,table.env=FALSE,caption="nothing")
> #error - german R error message:
> #Fehler in latex.table(tab, table.env = FALSE, caption = "nothing") :
> # you must have table.env=TRUE if caption is given
> The second problem is, that - when using latex.table to produce a
> tabular within a table environment - I would like to specify cgroup
> with only one value - one multicolumn being a heading for both columns
> in the table.
> But I'm not able to produce latex-compilable code:
> latex.table(tab,cgroup="v2",caption="my table")
> gives me the following latex code:
> \begin{table}[hptb]
> \begin{center}
> \begin{tabular}{|l||c|c|} \hline
> \multicolumn{1}{|l||}{\bf
> tab}&\multicolumn{}{c||}{}&\multicolumn{2}{c|}{\bf v2}\\ \cline{2-3}
> \multicolumn{1}{|l||}{}&\multicolumn{1}{c|}{val1}&\multicolumn{1}
> {c|}{val2}\\
> \hline
> val1&1&1\\
> val2&0&1\\
> \hline
> \end{tabular}
> \vspace{3mm}
> \caption{my table\label{tab}}
> \end{center}
> \end{table}
> and within this code the problem is the second multicolumn
> (&\multicolumn{}{c||}{}), as it has no number specifying how many
> columns the multicolumn should cover. Latex (at least my version)
> complains.
> When deleting this part of the code, the table is compiled and looks
> exactly how I want it to look. I'm doing this with a system call and
> an shell script right now, but this seems pretty ugly to me...
> When I specify 2 columns, this problem doesn't occur:
> latex.table(tab,cgroup=c("blah","v2"),caption="my table")
> I'm running R Version 2.3.0 (2006-04-24) on a linux machine Fedora
> Core 5 (i386).
> Can anyone help me find my mistakes?
> Thanks a lot
> ... and sorry for my bad English and potential newbie mistakes!!
> Kati
> ______________________________________________
> mailing list
> PLEASE do read the posting guide
> guide.html
> and provide commented, minimal, self-contained, reproducible code. mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Thu Jan 11 05:55:56 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 10 Jan 2007 - 19:31:38 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.