Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4105340
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T21:14:03+00:00 2026-05-20T21:14:03+00:00

OK, I admit this one is a bit uptight (read: stupid), and I assume

  • 0

OK, I admit this one is a bit uptight (read: “stupid”), and I assume it’s quite easy too. I’m writing a report and I want to use xtable package for LaTeX table generation (note that memisc package does the job, but say I want to do this solely with xtable).

Let’s use standard mtcars dataset and reshape package:

mdtf <- melt(mtcars, id.vars = c("am", "cyl"), measure.vars = c("mpg", "hp", "wt"))
( res <- cast(mdtf, am + cyl ~ variable, mean) )
  am cyl      mpg        hp       wt
1  0   4 22.90000  84.66667 2.935000
2  0   6 19.12500 115.25000 3.388750
3  0   8 15.05000 194.16667 4.104083
4  1   4 28.07500  81.87500 2.042250
5  1   6 20.56667 131.66667 2.755000
6  1   8 15.40000 299.50000 3.370000

If I wrap this inside xtable, I’ll get row names (1..6):

xtable(res)
% latex table generated in R 2.13.0 by xtable 1.5-6 package
% Fri Mar 25 09:40:12 2011
\begin{table}[ht]
\begin{center}
\begin{tabular}{rrrrrr}
  \hline
 & am & cyl & mpg & hp & wt \\ 
  \hline
1 & 0.00 & 4.00 & 22.90 & 84.67 & 2.94 \\ 
  2 & 0.00 & 6.00 & 19.12 & 115.25 & 3.39 \\ 
  3 & 0.00 & 8.00 & 15.05 & 194.17 & 4.10 \\ 
  4 & 1.00 & 4.00 & 28.07 & 81.88 & 2.04 \\ 
  5 & 1.00 & 6.00 & 20.57 & 131.67 & 2.75 \\ 
  6 & 1.00 & 8.00 & 15.40 & 299.50 & 3.37 \\ 
   \hline
\end{tabular}
\end{center}
\end{table}

Now, is there any chance that I can avoid this (in one-liner, if possible)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T21:14:04+00:00Added an answer on May 20, 2026 at 9:14 pm

    Use include.rownames=FALSE in the print method.
    See ?print.xtable:

    R> print(xtable(res), include.rownames=FALSE)
    
    % latex table generated in R 2.12.2 by xtable 1.5-6 package
    % Fri Mar 25 10:06:08 2011
    \begin{table}[ht]
    \begin{center}
    \begin{tabular}{rrrrr}
      \hline
    am & cyl & mpg & hp & wt \\ 
      \hline
    0.00 & 4.00 & 22.90 & 84.67 & 2.94 \\ 
      0.00 & 6.00 & 19.12 & 115.25 & 3.39 \\ 
      0.00 & 8.00 & 15.05 & 194.17 & 4.10 \\ 
      1.00 & 4.00 & 28.07 & 81.88 & 2.04 \\ 
      1.00 & 6.00 & 20.57 & 131.67 & 2.75 \\ 
      1.00 & 8.00 & 15.40 & 299.50 & 3.37 \\ 
       \hline
    \end{tabular}
    \end{center}
    \end{table}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

OK so I admit right off the top that this is a bit screwy
Bit confused with this one. Basically, I have a column in a table, and
I have to admit I am COMPLETELY stumped on this one. I've been scouring
This is my first post and I have to admit, I am terrible at
Background I admit, this question stems from an ultimate lack of deep understanding of
This may seem really silly to you, I admit, but when discussing the Model-View-ViewModel
I've seen this and I have to admit I'm pretty impressed: (source: blogspot.com )
I must admit that I don't really know if this is the right place
I have this simple script that I'm working on. I must admit, I'm totally
This problem is about concurrent high speed inserts. I must admit it is very

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.