1

I have a latex table generated as following in R:

\documentclass[12pt,econ]{authesis}    
\usepackage{natbib}  % natbib citation style
    \usepackage{url}     % added 2015-067-06 bc the example .bib uses url
    \usepackage{graphicx}
    \usepackage{amsmath}
    \usepackage{authblk}
    \usepackage{placeins}
    \usepackage{booktabs}
    \usepackage{ragged2e}
    \usepackage{array, tabularx,multirow, makecell}
    \usepackage{multicol}
    \usepackage{commath}
    \usepackage{dcolumn}
    \setcellgapes{3pt}
    \usepackage{hyperref}
    \usepackage{cleveref}
    \usepackage{subfig}  % to construct sub figures
    \usepackage{anysize}  % for page margins
    \usepackage{adjustbox}
    \usepackage{rotating} %to rotate tables
    \usepackage{pdflscape}

\begin{document}
    \begin{table}[ht]
    \centering
    \begin{tabular}{}
      & myEstVector.cf\_10 & myEstVector.cf\_25 & myEstVector.cf\_50 & myEstVector.cf\_75 & myEstVector.cf\_90 \\ 
     1 & 14.486 & 18.951 & 23.784 & 34.117** & 44.131** \\ 
      2 & (1.23) & (1.512) & (2.015) & (2.784) & (3.56) \\ 
      3 & -1.108 & -1.863 & -2.475 & -3.361* & -3.993* \\ 
      4 & (-0.846) & (-1.198) & (-1.671) & (-2.041) & (-2.537) \\ 
      5 & 0.504*** & 0.482*** & 0.425*** & 0.348*** & 0.292** \\ 
      6 & (4.77) & (5.507) & (4.846) & (4.136) & (3.07) \\ 
      7 & -0.808** & -0.434 & -0.129 & 0.027 & -0.023 \\ 
      8 & (-2.792) & (-1.412) & (-0.501) & (0.136) & (-0.119) \\ 
      9 & 0.001 & -0.001 & -0.002 & -0.003 & -0.003*** \\ 
      10 & (0.105) & (-0.129) & (-2.645) & (-4.392) & (-4.41) \\ 
      11 & -0.01 & -0.001 & 0.031 & 0.009 & -0.026 \\ 
      12 & (-0.237) & (-0.042) & (1.089) & (0.244) & (-0.728) \\ 
      13 & -0.108 & -0.14** & -0.087 & -0.052 & -0.016 \\ 
      14 & (-1.965) & (-2.545) & (-1.776) & (-1.394) & (-0.416) \\ 
      15 & -0.789** & -0.99** & -1.445*** & -1.424*** & -1.948*** \\ 
      16 & (-2.809) & (-3.079) & (-3.892) & (-4.021) & (-4.893) \\ 
      \end{tabular}
    \end{table}
\end {document}

When I run it in the TexShop, I get this error

Package array Error: Empty preamble : `l' used. 
See the array package documentation for explanation. Type H <return> for immediate help.
...
l.393 \begin{tabular}{}
?

I am using Texshop and compiling this under pdflatex. Can anyone please give a suggestion to solve the problem?

Note: The R code to create the table above is as follows:

ltxtable=xtable(myNewTable,align=rep("",ncol(myNewTable)+1))
print(ltxtable, floating=TRUE, hline.after=NULL, include.rownames=TRUE, include.colnames=TRUE)
6
  • Can you please cancel all irrelevant packages? And do you want to know why this table does not compile or why R generates it faultily?
    – Ruben
    Apr 16 '16 at 23:38
  • @Ruben I figured out where the problem is. I should have corrected \begin{tabular}{} into \begin{tabular}{lllll}. However, I would like to know why R gave me the code faultily.
    – Demet
    Apr 16 '16 at 23:45
  • Very good! :) Regarding the actual problem, the interpretation of data from R, I can't really say anything. Maybe there is somebody else here on TeX.SX who is more experienced with it. Anyways, I think stackoverflow is the right place for your question.
    – Ruben
    Apr 16 '16 at 23:53
  • Then you probably have to show the code you gave R ....
    – cfr
    Apr 16 '16 at 23:53
  • @cfr R code is added.
    – Demet
    Apr 17 '16 at 0:05
1

Change

ltxtable=xtable(myNewTable,align=rep("",ncol(myNewTable)+1)) 

to

ltxtable=xtable(myNewTable,align=rep("l",ncol(myNewTable)+1))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.