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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:05:02+00:00 2026-06-13T05:05:02+00:00

Given a table of values (say between 0 to 100) and the attached plot,

  • 0

Given a table of values (say between 0 to 100) and the attached plot, what would be the simplest way using R to calculate how many of the data points fall between values 20 – 60 (the red box in the image)?

And is there a way to create that red box using R’s plotting functions (I did it using a image editor…)?

Thanks for the help.
enter image description here

  • 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-13T05:05:02+00:00Added an answer on June 13, 2026 at 5:05 am

    To calculate the probability mass contained within the interval:

    x <- rnorm(1e6)  ## data forming your empirical distribution
    ll <- -1.96      ## lower bound of interval of interest
    ul <- 1.96       ## upper bound of interval of interest
    
    sum(x > ll & x < ul)/length(x)
    # [1] 0.949735
    

    And then to plot the histogram and the red box:

    h <- hist(x, breaks=100, plot=FALSE)       # Calculate but don't plot histogram
    maxct <- max(h$counts)                     # Extract height of the tallest bar
    ## Or, if you want the height of the tallest bar within the interval
    # start <- findInterval(ll, h$breaks)
    # end   <- findInterval(ul, h$breaks)
    # maxct <- max(h$counts[start:end])
    
    plot(h, ylim=c(0, 1.05*maxct), col="blue") # Plot, leaving a bit of space up top
    
    rect(xleft = ll, ybottom = -0.02*maxct,    # Add box extending a bit above
         xright = ul, ytop = 1.02*maxct,       # and a bit below the bars
         border = "red", lwd = 2)
    

    enter image description here

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

Sidebar

Related Questions

Given a table of input data I would like to have a set o
Updated I have some huge data, which becomes a large table say table parent
Say I have a voting table, where users can vote on values up, down,
I am using php/mysql for a search. My table is 'height' and data type
My Python High Replication Datastore application requires a large lookup table of between 100,000
By using normal minus '-' function between two timestamps, the answer given from oracle
given the two tables and values: Tables People- Columns: [ID]PK Name Field - Columns:
Given table: ID ONE TWO X1 15 15 X2 10 - X3 - 20
Given the table: CREATE TABLE IF NOT EXISTS `users` ( `id` bigint(20) NOT NULL
Given: CREATE TABLE foo (id BIGINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id)); I'd like 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.