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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:40:13+00:00 2026-05-25T10:40:13+00:00

High school statistics teacher here, so sorry for the simple question (or maybe not

  • 0

High school statistics teacher here, so sorry for the simple question (or maybe not so simple).

I’m running R to create a stem-and-leaf plot. I’m trying to turn a stem-and-leaf output from stem() into LaTeX. Here is what I’ve got so far:

y<- c(50, 26, 31, 57, 19, 24, 22, 23, 38, 13, 50, 13, 34, 23, 30, 49, 13, 15, 51)
stem(y)

I’ve tried to use xtables (because it works for my simple two-way tables) as such:

print(xtable(stem(y)), type="latex", latex.environments=c("center"), tabular.environment =    "tabular", NA.string = "")

and I get this error:

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

I’ve tried variations on the the options, but get similar results. From what I can figure, the output from stem() isn’t a data frame or matrix, so xtables doesn’t like it. I tried changing it to a data frame/matrix using as.data.frame() and as.matrix() but with no success. Any help would be appreciated. I’ve run a few google searches with no useful results and looked through the stackoverflow site. Any help would be appreciated.

  • 1 1 Answer
  • 2 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-25T10:40:13+00:00Added an answer on May 25, 2026 at 10:40 am

    I am assuming that you just want to export the result to latex, am I right?

    You might want to try the following Sweave code, which passed the test:

    \documentclass{article}
    
    \usepackage{listings}
    
    \begin{document}
    
    \begin{lstlisting}
    <<echo=F, results=tex>>=
    y<- c(50, 26, 31, 57, 19, 24, 22, 23, 38, 13, 50, 13, 34, 23, 30, 49, 13, 15, 51)
    stem(y)
    @ 
    \end{lstlisting}
    
    \end{document}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We'll soon have some high school kids here in our company for some training
I am building a high school team application using Django. Here is my working
Today at school the teacher asked us to implement a duplicate-deletion algorithm. It's not
Some high school math concept has been forgotten, so I ask here. If I
My Java teacher (High school course) was talking about loops and she said that
In school (high school), my partner and I are developing an Android tablet application.
So in high school math, and probably college, we are taught how to use
I am a high school student and am thinking of making a robot that
So I'm a high school student taking an iPhone development class. For my final
One of my high school students and I are going to try to do

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.