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 8095207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:02:49+00:00 2026-06-05T21:02:49+00:00

I am using xtable in R to get LaTeX code for tables. I want

  • 0

I am using xtable in R to get LaTeX code for tables. I want to modify the first element of the “header” (first row in LaTeX table) but I only saw an option to add text to the end of a line (using add.to.row in xtable).

The following example should clarify what I want.

Running

xtable(matrix(c(1,0.25,3,0.75),nrow=2,dimnames=list(c('absolute','relative'),c('GNU','Leo'))))

gives the output

% latex table generated in R 2.13.0 by xtable 1.5-6 package
% Tue Jun 19 22:39:49 2012
\begin{table}[ht]
\begin{center}
\begin{tabular}{rrr}
  \hline
 & GNU & Leo \\ 
  \hline
absolute & 1.00 & 3.00 \\ 
  relative & 0.25 & 0.75 \\ 
   \hline
\end{tabular}
\end{center}
\end{table}

I would like to get the line

  frequency & GNU & Leo \\ 

instead of the line

  & GNU & Leo \\

but I was unable to accomplish this using xtable. Let me know if you have an idea how to do this. Also, I apologize in advance if this is in the wrong place to ask or if I overlooked an answer or an obvious solution.

  • 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-06-05T21:02:51+00:00Added an answer on June 5, 2026 at 9:02 pm

    Another option is to use the latex function from Hmisc:

    library(Hmisc)
    m <- matrix(c(1,0.25,3,0.75),nrow=2,dimnames=list(c('absolute','relative'),c('GNU','Leo')))
    latex(m,file = "",rowlabel = "frequency")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wonder how to get LATEX table using xtable function from the following R
I've got a table and want to outer-join another table, getting only the first
I'm using xtable to manage R output in Sweave . See code below: CC
Using the C# Facebook SDK 5.0.3 everything works fine whit the client.Get(/me). But when
I'm using jCanvas to paint on a HTML canvas element. First I initialize a
I've a list of tables and want to sweave it for LaTex output. Here
Using a populated Table Type as the source for a TSQL-Merge. I want to
We are using audit tables for each operational table, which stores the previous value
Using DMD 2.057, I cannot get the following code to compile: import std.stdio; import
Using LINQ on collections, what is the difference between the following lines of code?

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.