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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:17:14+00:00 2026-05-28T07:17:14+00:00

I am using R to calculate some basic statistic results. I am using the

  • 0

I am using R to calculate some basic statistic results. I am using the quantile() function,to calulate quantiles on a data frame column as follows.

> quantile(foobars[,1])
     0%     25%     50%     75%    100% 
 189000  194975  219500  239950 1000000 

I want to be able to individually access the calculated quantiles. However, I can’t seem to find out how to do that. When I check the class of the returned result, it a 1 dimensional numeric.

I tried this:

> q <- quantile(foobars[,1])
> q[3]
   50% 
219500

Which seems to return a tuple (quantile level + number). I am only interested in the number (219500 in this case.

How may I access only the number into a simple (numeric) variable?

  • 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-28T07:17:14+00:00Added an answer on May 28, 2026 at 7:17 am

    You are confusing the printed representation of the numeric value with the actual value. As far as R is concerned, q contains a named numeric vector:

    > dat <- rnorm(100)
    > q <- quantile(dat)
    > q
            0%        25%        50%        75%       100% 
    -2.2853903 -0.5327520 -0.1177865  0.5182007  2.4825565 
    > str(q)
     Named num [1:5] -2.285 -0.533 -0.118 0.518 2.483
     - attr(*, "names")= chr [1:5] "0%" "25%" "50%" "75%" ...
    

    All the “named” bit means is that the vector has an attached attribute "names" containing the (in this case) quantile labels. R prints these for a named vector as they are considered helpful to have in printed output if present. But, they in no way alter the fact that this is a numeric vector. You can use these in computations as if they didn’t have the "names" attribute:

    > q[3] + 10
         50% 
    9.882214
    

    If the names bother you, the unname() function exists to remove them:

    > q2 <- unname(q)
    > q2
    [1] -2.2853903 -0.5327520 -0.1177865  0.5182007  2.4825565
    

    For completeness, I should probably add that you can extract the "names" using the names() function, which also has an assignment version ('names<-'()). So another way to remove the names from a vector is to assign NULL to the names:

    > q3 <- q
    > names(q3)
    [1] "0%"   "25%"  "50%"  "75%"  "100%"
    > names(q3) <- NULL
    > names(q3)
    NULL
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a dataset which im using to calculate some sales figures, this data
I am using quaternions in my game to calculate some basic angles. Now I
I am using JQuery to calculate some totals figures and I have run into
In our asp.net 2.0 app we are using httpmodule and httphandler to calculate some
I created a RESTful service using WCF which calculates some value and then returns
Right now all I am using to calculate the size are the files in
I'm using GMP to calculate very large factorials (e.g. 234234!). Is there any way
We are supposed to calculate e^x using this kind of formula: e^x = 1
How to calculate approximately the connection speed of a website using JavaScript? I want
I am trying to calculate a determinant using the boost c++ libraries. I found

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.