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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:28:29+00:00 2026-06-13T19:28:29+00:00

This problem comes from easier problem which I managed to solve myself. So here

  • 0

This problem comes from easier problem which I managed to solve myself. So here is my original question.

In my data I have lots of categories, but i’m not interested in estimating coefficients for all of them, I just want to test the hypothesis, that there is no difference in categories. And calling summary on my object produces most information that I don’t need for my report.

set.seed(42)
dat <- data.frame(cat=factor(sample(1:10, 100, replace=T)), y=rnorm(100))
l1 <- lm(y~cat-1, data=dat)
summary(l1)

How do I extract only the last line from call to summary(l1)?

In this particular case I can just used anova function

anova(l1)

and got only the info that I needed, just in different formatting than summary(l1) produces.

What if I have some kind of a summary on an object and I want to extract just particular part of summary(object) how do I do that? For example, how do I get R to print only the line of call summary(l1)?

p.s. I am aware of summary(l1)$fstatistic.

  • 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-13T19:28:31+00:00Added an answer on June 13, 2026 at 7:28 pm

    OK, I’m in a literal mood, but using capture.output will return the character representation of an evaluated object. So for example, using your l1 object:

    l1Out <- capture.output(summary(l1))
    grep("^F-st", l1Out, value = TRUE)
    # [1] "F-statistic: 1.323 on 10 and 90 DF,  p-value: 0.2303 "
    

    Note, however, that this is not the last line of output:

    tail(l1Out, 1)
    # [1] ""
    

    And for many components of the summary object, there are better ways to extract information, such as @seancarmody wrote

    l1$call
    # lm(formula = y ~ cat - 1, data = dat)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using $SUB for the first time and have come across this problem.
I'm fairly new to LWJGL/OpenGL and I've come across this problem which I can't
This problem is same as asked in here . Given a list of coins,
Friends, I'm converting an Oracle Form to Apex and have run into problem(s?) which
I have a wizard style interface where I need to collect data from users.
By some coincidence this problem has come up twice in the last week. A
This is a problem I come across every so often; I always end up
Hard to come up with a proper title for this problem. Anyway... I'm currently
This is an age old problem - but now I'm using scriptaculous its come
This problem seems very simple to me, but I've been unable to fix it,

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.