[R] cut with intervals open on the right?

Uwe Ligges ligges at statistik.uni-dortmund.de
Fri Oct 19 12:27:27 CEST 2007


Works for me with current R-2.6.0 (but you haven't told us about your R 
version!):

 > cut(1:5, 1:5)
[1] <NA>  (1,2] (2,3] (3,4] (4,5]
Levels: (1,2] (2,3] (3,4] (4,5]
 > cut(1:5, 1:5, right=FALSE)
[1] [1,2) [2,3) [3,4) [4,5) <NA>
Levels: [1,2) [2,3) [3,4) [4,5)


Uwe Ligges

Pedro de Barros wrote:
> Dear All,
> 
> I am trying to use cut() to produce intervals open on the right, but 
> it seems to ignore the argument right=F, contrary to what is 
> indicated on the help for cut.
> 
> Can anyone help?
> 
> Thanks,
> Pedro
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list