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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:42:51+00:00 2026-05-27T18:42:51+00:00

I am trying to figure out what the right parameter in the hist function

  • 0

I am trying to figure out what the right parameter in the hist function in R does. The documentation is unfortunately unclear to someone without a deep understanding of statistics such as myself.

The documentation as stated online is:

right logical; if TRUE, the histograms cells are right-closed (left open) intervals.

What does it mean to be right-closed (or left open) intervals?

  • 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-27T18:42:52+00:00Added an answer on May 27, 2026 at 6:42 pm

    When creating histograms of non-categorial data (things like pH, temperature, etc.), you need to specify things called “bins”. Each bin has something called an interval specified for it. For example, if I have the data:

    11  12  13  14  15  16  17  18  19
    

    I can create 5 bins with right-open, left-closed intervals like this:

    1st bin: [10, 12)
    2nd bin: [12, 14)
    3rd bin: [14, 16)
    4th bin: [16, 18)
    5th bin: [18, 20)
    

    What this means is that the first bin will “hold” values between 10 and 12, including 10 but not including 12. The interval notation used above is shorthand for this:

    1st bin: 10 ≤ x < 12
    2nd bin: 12 ≤ x < 14
    3rd bin: 14 ≤ x < 16
    4th bin: 16 ≤ x < 18
    5th bin: 18 ≤ x < 20
    

    So that means the values 11 will go into the 1st bin, but the value 12 will go into the second bin, etc. R will do this binning process for you then draw the histogram based on how many items are in each bin. For the above data, you’ll get a rather not-interesting (or interesting, depending on your expectations) histogram that is mostly flat except at the first bin.

    The following examples illustrate what the different combinations of brackets and parentheses mean when using interval notation (assume x is an element of the real number line):

    (1, 4) --> 1 < x < 4    left-open, right-open
    [3, 7) --> 3 ≤ x < 7    left-closed, right-open
    (2, 9] --> 2 < x ≤ 9    left-open, right-closed
    [5, 6] --> 5 ≤ x ≤ 6    left-closed, right-closed
    

    Note that you can’t use brackets for infinities, assuming you’re not using the extended real number line

    (-∞, ∞)   -->   -∞ < x < ∞ 
    (-∞, 20]  -->   -∞ < x ≤ 20 
    [20, ∞)   -->   20 ≤ x < ∞
    (1000, ∞) --> 1000 < x < ∞
    (-∞, ∞]   -->   Invalid
    (41, ∞]   -->   Invalid
    

    If I want left-open, right-closed intervals, then the bins would look like this:

    1st bin: (10, 12] i.e. 10 < x ≤ 12
    2nd bin: (12, 14]      12 < x ≤ 14
    3rd bin: (14, 16]      14 < x ≤ 16
    4th bin: (16, 18]      16 < x ≤ 18
    5th bin: (18, 20]      18 < x ≤ 20
    

    See the difference? In this case, now values 11, and 12 will go into the first bin. This may change in the appearance of the histogram depending on how you bin the data. Now, this time your histogram is still almost flat but now the 5th bin is different from the rest (only 1 data point instead of 2 for the rest).

    Now, fortunately in R you don’t have to specify the bins yourself, but R is nice enough to ask you whether you want the bins to be left-closed, right-open ([a, b)) or left-open, right-closed ((a, b]). That’s the difference you get w.r.t the “right” parameter does in the hist() function.

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

Sidebar

Related Questions

Right now I'm trying to figure out a way to do things smarter, and
I am trying to figure out the right regexp to match on list item
I am still trying to figure out the right architecture for a complex ASP.NET
I'm trying to figure out what the tag parameter on some of the NotificationManager's
In a previous question , I was trying to figure out the right strategy
I'm trying to figure out a way to store metadata about a column without
Trying to figure out an equation to get the current group a page would
Trying to figure out the best way to set up collection lists for users
Trying to figure out which to use.
Trying to figure out how to programmatically access the web pages in the application.

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.