[R] Two xtable Questions

Kevin Wang Kevin.Wang at maths.anu.edu.au
Thu Sep 2 12:59:16 CEST 2004


Hi,

These are two problems I've never seen when I used xtable() before...

R 1.9.1 for Windows XP, xtable version 1.2-3:
  > final.df
              Loci Chr    Marker Position P.values Deviance DF
  1           Idd5   1  D1Mit181     42.6   0.0011   103.21 78
  2     Idd6/19/20   6  D6Mit374     66.7   0.0014   104.29 78
  3          Idd13   2  D2Mit490     64.5   0.0025    97.83 78
  4        Idd8/12  13 D14Mit109       24   0.0244   102.41 78
  5          Idd14  14  D13Mit39      3.3   0.0379    95.92 78
  6  Idd3/10/17/18   3  D3Mit257     49.2    0.068   105.45 78
  7           Idd9   4  D4Mit233     69.9   0.1406   107.13 78
  8          Idd15   5  D5Mit338     43.7   0.2196   107.67 78
  9           Idd7   7  D7Mit101     45.9   0.4608    95.96 78
  10          Idd2   9  D9Mit328     17.5   0.5125   107.25 78
  11          Aire  10 D10Mit198     33.9   0.6457   106.13 78
  12          Idd4  11 D11Mit298     37.2   0.9261   107.47 78
  13         Idd21  18 D18Mit135      9.8   0.9272   107.67 78
  > xtable(final.df,
  +        caption = "Summary for each Locus",
  +        label = "tab:sumLocus")
  Error in x + ifelse(x == 0, 1, 0) : non-numeric argument to binary
operator
  > is.data.frame(final.df)
  [1] TRUE

final.df is a data frame, but I cannot understand what the error message
means about "non-numeric argument to binary operator".

The other problem is:
  > one.df
       Loci P.values
  1    Idd5   0.1147
  2   Idd13   0.0085
  3   Idd14    0.002
  4 Idd8.12    0.042
  5    Idd7   0.0114
  > xtable(one.df,
  +        caption = "Fitting without Interactions",
  +        label = "tab:noI")
  tab:noI
  % latex table generated in R 1.9.1 by xtable 1.2-3 package
  % Thu Sep 02 14:22:01 2004
  \begin{table}[ht]
  \begin{center}
  \begin{tabular}{rll}
  \hline
   & Loci & P.values \\
  \hline
  1 &    Idd5 & 0.1147 \\
  2 &   Idd13 & 0.0085 \\
  3 &   Idd14 &  0.002 \\
  4 & Idd8.12 &  0.042 \\
  5 &    Idd7 & 0.0114 \\
  \hline
  \end{tabular}
  \caption{Fitting without Interactions}
  \end{center}
  \end{table}
  > is.data.frame(one.df)
  [1] TRUE

I want to give the resulting LaTeX markup for one.df a label, namely
"tab:noI", but instead of putting a \label{tab:noI}, it just put "tab:noI"
at the beginning of the output.

I've tried to completely clear the workspace, delete the .RData and start
fresh.  But the problems still occur *_*.

Any help would be appreciated!

Kevin

--------------------------------
Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301




More information about the R-help mailing list