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

  • SEARCH
  • Home
  • 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 7623031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:36:10+00:00 2026-05-31T04:36:10+00:00

Let me create some data before I ask my question. my.data <- data.frame(A =

  • 0

Let me create some data before I ask my question.

 my.data <- data.frame(A = sample(seq(1,100,by=5),10,replace=TRUE),W = rnorm(10),X =sample(1:10),Y = sample(c("yes", "no"), 10, replace = TRUE),Z=sample(c('a','b','c','d'),10,replace=TRUE))

attach(my.data)

my.d <- xtabs(W~Z+Y+A);my.d
table.data <- ftable(my.d)

result1 <- round(table.data,2)

result1 looks like ..

      A     6    11    16    26    71    76    86    91
Z Y                                                    
a no     0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
 yes    0.00  0.56  0.00  0.00  0.00  0.79  0.00  0.01

b no     0.61  0.00 -0.22  0.14  0.00  0.00 -0.08  1.71
  yes    0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00

c no     0.00  0.00  0.00  0.00 -0.08  0.00  0.00  0.00
  yes    0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00

d no     0.00  0.00  0.00  0.00  1.00  0.00  0.00  0.00
  yes    0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00

I am actually writing an article using knitr package.
Is there a way to transform result1 into a latex table
automatically when my *.rnw file is complied ?

I tried with xtable but got the following error…

Error in UseMethod("xtable") :   no applicable method for 'xtable' applied to an object of class "ftable"

Thank you @DWin and @Yihui. Apart from latex(), I also used xtable as stated under

print(xtable(ftable2data.frame(result1)))

To remove unnecessary row names I did the following

print(xtable(ftable2data.frame(result1)),include.rownames=FALSE)
  • 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-31T04:36:11+00:00Added an answer on May 31, 2026 at 4:36 am

    Method 1:

    require(MIfuns)
    require(Hmisc)
    latex(ftable2data.frame(result1))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I create an instance of a class and want to assign some
I’d like to ask you a question again if you have some time. I
I want to create a user control, which can be bound to some data
Yes, I know, the old question of the best web framework ... but let
We let users create ad-hoc queries in our website. We would like to have
Can PL/SQL procedure in Oracle know it's own name? Let me explain: CREATE OR
Let's say you create a wizard in an HTML form. One button goes back,
Let's say that I create a Sub (not a function) whose mission in life
Let's say I create a jagged 2d array like so: public static char[,] phoneLetterMapping
Let's say that you want to create a dead simple BlogEditor and, one of

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.