Reputation: 2611
How do you get "intervals" (not bins) from hist()
?
If I run hist(VARIABLE,seq(0,30,by=3)
. The idea is to get a vector like this :
(0,3]
(3,6]
...
I know I can get it by this command :
unique(cut(VARIABLE,seq(0,30,by=3))
But it looks like very unefficient since we have to generate this long length vector first.
Upvotes: 0
Views: 871
Reputation: 2611
I found what I wanted. Here it is :
levels(cut(VARIABLE,breaks=hist(VARIABLE,seq(0,230,by=3))$breaks))
Upvotes: 1