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

Privacy regulations: fear, loathing and AOL
5 Key Takeaways for Businesses from Google I/O 2015
Social software adoption, how are we doing?
Tips for the new CTO: How to engineer a miracle
See you at PAW (Predictive Analytics World) and Teradata Partners

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

Image
Uncategorized

The Biggest Contradiction of Big Data

6 Min Read

How to disrupt Wall Street

7 Min Read

Technology in the Classroom: Extend Learning After the School Day

4 Min Read

Are There Business Advantages to Poor Data Management?

5 Min Read

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

data-driven web design
5 Great Tips for Using Data Analytics for Website UX
Big Data
ai in ecommerce
Artificial Intelligence for eCommerce: A Closer Look
Artificial Intelligence

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?