Stephen K
Stephen K

Reputation: 737

R histogram - define ranges?

I have a list of customers and then the total amount they have spent. I want to do a histogram of this, but I only want to do for general ranges and not each dollar amount.

Something like 0-500, 501-1000, 1001 - 1500 and so on. is it possible to define these and have the histogram automatically group these together?

Upvotes: 3

Views: 5739

Answers (1)

Anders Ellern Bilgrau
Anders Ellern Bilgrau

Reputation: 10223

Something like

hist(x, breaks = c(0, 500, 1000, 1500))

should do it. See ?hist.

Upvotes: 3

Related Questions