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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:22:51+00:00 2026-06-07T18:22:51+00:00

This is a fairly basic question, but haven’t seen a good answer on various

  • 0

This is a fairly basic question, but haven’t seen a good answer on various forums.
Say I’ve a simple vector

x = runif(10,1,4)
> x
[1] 3.292108 1.388526 2.774949 3.005725 3.904919 1.322561 2.660862 1.400743
[9] 2.252095 3.567267
> 

Next I compute some quantiles,

> z = quantile(x,c(0.1,0.8))
> z
 10%      80% 
1.381929 3.347140 
> 

I need this output as a data frame. So I tried the following

> y = data.frame(id = names(z),values=z)
> y
 id   values
10% 10% 1.381929
80% 80% 3.347140

I see that the “%” column is repeated. Also when I try

> y$id[1]
[1] 10%
Levels: 10% 80%

whereas I’m expecting it to be either just “10%” or 0.1
Any help appreciated.

  • 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-07T18:22:52+00:00Added an answer on June 7, 2026 at 6:22 pm

    The names are just the probabilities so

    y <- data.frame(id = c(0.1, 0.8), values = z) 
    

    Would work.

    So would wrapping it in a function that returns a data.frame

    quantile_df <- function(x, probs, na.rm =F, names = F, type = 7, ...){
      z <- quantile(x, probs, na.rm, names, type)
      return(data.frame(id = probs, values = z))
    }
    
    quantile_df(x, probs = c(0.1, 0.8))
    ##    id   values
    ## 1 0.1 1.343383
    ## 2 0.8 2.639341
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a fairly basic question, but I haven't been able to find any
This is probably a fairly basic question but I haven't managed to find anything
This is a fairly basic question about state server but assume there are 2
This is a fairly basic question about CakePHP, but since my knowledge of this
All, This would seem like a fairly basic asp.net question - but in all
I posted this basic question before, but didn't get an answer I could work
This is fairly simple but I cant work it out. I'm building a wordpress
This is fairly simple in Windows, but a little tricky in Linux. I am
I guess this is fairly simple for you but i cant wrap my head
This seems to me like a very simple question, but I can't seem to

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.