Cookies help us display personalized product recommendations and ensure you have great shopping experience.

By using this site, you agree to the Privacy Policy and Terms of Use.
Accept
SmartData CollectiveSmartData Collective
  • Analytics
    AnalyticsShow More
    image fx (67)
    Improving LinkedIn Ad Strategies with Data Analytics
    9 Min Read
    big data and remote work
    Data Helps Speech-Language Pathologists Deliver Better Results
    6 Min Read
    data driven insights
    How Data-Driven Insights Are Addressing Gaps in Patient Communication and Equity
    8 Min Read
    pexels pavel danilyuk 8112119
    Data Analytics Is Revolutionizing Medical Credentialing
    8 Min Read
    data and seo
    Maximize SEO Success with Powerful Data Analytics Insights
    8 Min Read
  • Big Data
  • BI
  • Exclusive
  • IT
  • Marketing
  • Software
Search
© 2008-25 SmartData Collective. All Rights Reserved.
Reading: Making publication-ready tables with xtable
Share
Notification
Font ResizerAa
SmartData CollectiveSmartData Collective
Font ResizerAa
Search
  • About
  • Help
  • Privacy
Follow US
© 2008-23 SmartData Collective. All Rights Reserved.
SmartData Collective > Uncategorized > Making publication-ready tables with xtable
Uncategorized

Making publication-ready tables with xtable

DavidMSmith
DavidMSmith
3 Min Read
SHARE

When you use R at the command-line, the textual output is limited by the medium: one monospaced font, with no typesetting of any kind. That’s great when you’re doing exploratory analysis, but what about when you want to include R output in a report or publication? In other words, what if you want to convert this Analysis of Variance table:

 
Df Sum Sq Mean Sq F value Pr(>F)
sex 1 75.4 75.37 0.3793 0.539478
ethnicty 3 2572.1 857.38 4.3147 0.006781 **
sex:ethnicty 2 298.4 149.22 0.7509 0.474767
Residuals 93 18480.0 198.71

to this:

Aov 

or this…

More Read

The Case Against Collaboration, Part I
No Privacy Through Difficulty
The Macroeconomics of Information and Attention: How the Economy Works as A Whole
Scientists misusing Statistics
Big Data moves up the stack

When you use R at the command-line, the textual output is limited by the medium: one monospaced font, with no typesetting of any kind. That’s great when you’re doing exploratory analysis, but what about when you want to include R output in a report or publication? In other words, what if you want to convert this Analysis of Variance table:

 
Df Sum Sq Mean Sq F value Pr(>F)
sex 1 75.4 75.37 0.3793 0.539478
ethnicty 3 2572.1 857.38 4.3147 0.006781 **
sex:ethnicty 2 298.4 149.22 0.7509 0.474767
Residuals 93 18480.0 198.71

to this:

Aov 

or this:

Df Sum Sq Mean Sq F value Pr(> F)
sex 1 75.37 75.37 0.38 0.5395
ethnicty 3 2572.15 857.38 4.31 0.0068
sex:ethnicty 2 298.43 149.22 0.75 0.4748
Residuals 93 18480.04 198.71

With the xtable package, you can. It’s a handy tool for converting the output of many of R’s statistical functions into a presentation-ready table in LaTeX or HTML format. For example, to create the table above, I simply did the following:

> fm2 <- lm(tlimth ~ sex * ethnicty, data = tli)
> print(xtable(anova(fm2)), type="html")

and then pasted the HTML it generated straight into this blog post. I also tweaked the border=”1″ table directive to border=”0″ — if you have a decent Web editor you could pretty the table up further to your heart’s desire.

You can find more examples of xtable in action in the package vignette.

xtable package: vignette
 

Link to original post

Share This Article
Facebook Pinterest LinkedIn
Share

Follow us on Facebook

Latest News

image fx (2)
Monitoring Data Without Turning into Big Brother
Big Data Exclusive
image fx (71)
The Power of AI for Personalization in Email
Artificial Intelligence Exclusive Marketing
image fx (67)
Improving LinkedIn Ad Strategies with Data Analytics
Analytics Big Data Exclusive Software
big data and remote work
Data Helps Speech-Language Pathologists Deliver Better Results
Analytics Big Data Exclusive

Stay Connected

1.2kFollowersLike
33.7kFollowersFollow
222FollowersPin

You Might also Like

Big Data Analytics: Unlock Breakthrough Results – Step 2

20 Min Read

Change Management and Data Governance

3 Min Read

Semantic Search Wikipedia Entry: Needs Help

2 Min Read

Tracking the Customer Journey Is Critical for Engagement

9 Min Read

SmartData Collective is one of the largest & trusted community covering technical content about Big Data, BI, Cloud, Analytics, Artificial Intelligence, IoT & more.

AI and chatbots
Chatbots and SEO: How Can Chatbots Improve Your SEO Ranking?
Artificial Intelligence Chatbots Exclusive
AI chatbots
AI Chatbots Can Help Retailers Convert Live Broadcast Viewers into Sales!
Chatbots

Quick Link

  • About
  • Contact
  • Privacy
Follow US
© 2008-25 SmartData Collective. All Rights Reserved.
Go to mobile version
Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?