Jonathan Rauscher
Jonathan Rauscher

Reputation: 157

R getting break values from histogram

When you make a histogram and define the breaks argument, R uses some functions to generate those breaks. I want to obtain the range values for the breaks generated by the histogram such that if I made the following histogram

hist(df$foo, breaks = 5)

I want a list or data.frame that has the value ranges of the breaks:

list(c("1_lower"="<num>","1_upper"="<num2>","2_lower"="<num3>","2_upper"="<num4>"))

I hope this is possible. Any help is greatly appreciated.

Upvotes: 0

Views: 755

Answers (1)

Andrew Gustar
Andrew Gustar

Reputation: 18425

According to the documentation ?hist - if you set h<-hist(...), then h$breaks will give you the breakpoints.

Upvotes: 3

Related Questions