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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:58:19+00:00 2026-05-23T16:58:19+00:00

Statistics test in R outputs many descriptions. While they are useful, how can we

  • 0

Statistics test in R outputs many descriptions. While they are useful, how can we just output or extract single values?

> cor.test(x,y,method="spearman", exact=F)

        Spearman's rank correlation rho

data:  x and y 
S = 12767993, p-value = 0.0001517
alternative hypothesis: true rho is not equal to 0 
sample estimates:
      rho 
-0.188074 

particularly, what to do to just get out these values 0.0001517 and -0.188074 so I can store them for further analyses?

  • 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-23T16:58:20+00:00Added an answer on May 23, 2026 at 4:58 pm

    You can use $ subsetting of the test object. The relevant names are p.value and estimate.

    > tst<-cor.test(1:10,rnorm(10),method="spearman")
    > tst
    
            Spearman's rank correlation rho
    
    data:  1:10 and rnorm(10) 
    S = 140, p-value = 0.6818
    alternative hypothesis: true rho is not equal to 0 
    sample estimates:
          rho 
    0.1515152 
    

    .

    > tst$p.value
    [1] 0.6818076
    > tst$estimate
          rho 
    0.1515152 
    

    Edit

    The other answers point out that you can investigate the structure of the object with str to find the names to use with $ subsetting. You can also find out the names with names:

    > names(tst)
    [1] "statistic"   "parameter"   "p.value"     "estimate"    "null.value" 
    [6] "alternative" "method"      "data.name" 
    

    Another thing to consider is that you are looking at the printed version of the object, and the print method may be performing some calculations (it isn’t in this case). You can check the object class with class(tst) which reveals it is of class htest. print.htest is the relevant print method, but this is non-visible, so use getAnywhere(print.htest) to view it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Where can I find statistics on mobile and desktop screen sizes? I'm making a
I do the following: Create a Web Performance Test. Browse around cnn.com while the
I installed the Statistics::Descriptive module using cpan then test the example: use Statistics::Descriptive; $stat
I have just set up a test that checks that I am able to
I have a statistics page which has a meta refresh tag on it. <meta
Are there any visitor statistics solutions for Ruby on Rails? I'm talking something like
I'm writing a statistics based application off a SQLite database. There is a table
Are there statistics or even estimates anywhere regarding the sizes of the various sectors
R is a statistics programming language. Part of R is the use of Packages,
I want to make voronoi treemaps for statistics data, like newsgraphy Do you know

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.