Re: [R] Trying to understand cut

2016-04-17 Thread David Winsemius
> On Apr 16, 2016, at 9:12 PM, John Sorkin wrote: > > Jeff, > Perhaps I was sloppy with my notation: > I want groups >> =0 <10 >> =10 <20 >> =20<30 > .. >> =90 <100 > > In any event, my question remains, why did the four different versions of cut > give me the same results? I hope someone

Re: [R] Trying to understand cut

2016-04-17 Thread peter dalgaard
This isn't really FAQ 7.31 (for once). The clue is in this part of cut.default(): breaks <- seq.int(rx[1L], rx[2L], length.out = nb) breaks[c(1L, nb)] <- c(rx[1L] - dx/1000, rx[2L] + dx/1000) which _is_ as documented. Notice that it is based on the range

Re: [R] Trying to understand cut

2016-04-16 Thread Jim Lemon
Hi John, Both the "right" and "include.lowest" arguments are usually useful when there are values equal to those in "breaks". A value equal to a break can fall on either side of the break depending upon these arguments: > nums<-1:100 > table(cut(nums,breaks=seq(0,100,by=10))) (0,10] (10,20] (2

Re: [R] Trying to understand cut

2016-04-16 Thread John Sorkin
Jeff, Perhaps I was sloppy with my notation: I want groups >=0 <10 >=10 <20 >=20<30 .. >=90 <100 In any event, my question remains, why did the four different versions of cut give me the same results? I hope someone can explain to me the function of include.lowest and right in the call to c

Re: [R] Trying to understand cut

2016-04-16 Thread Jeff Newmiller
Have you read FAQ 7.31 recently, John? Your whole premise is flawed. You should be thinking of ranges [0,10), [10,20), and so on because numbers ending in 0.9 are never going to be exact. -- Sent from my phone. Please excuse my brevity. On April 16, 2016 7:38:50 PM PDT, John Sorkin wrote: >

[R] Trying to understand cut

2016-04-16 Thread John Sorkin
I am trying to understand cut so I can divide a list of numbers into 10 group: 0-9.0 10-10.9 20-20.9 30-30.9, 40-40.9, 50-50.9 60-60.9 70-70.9 80-80.9 90-90.9 As I try to do this, I have been playing with the cut function. Surprising the following for applications of cut give me the exact same