cut with intervals open on the right?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

cut with intervals open on the right?

Pedro Conte de Barros
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

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: cut with intervals open on the right?

Uwe Ligges
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
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: cut with intervals open on the right?

Pedro Conte de Barros
Thanks for the quick and nice reply.
I must apologise twice:
1-I should have reported I am using R 2.5.1 on Windows;
2- It was a spelling error on my part (rigth instead of right).

Pedro

At 11:27 2007/10/19, you wrote:

>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
>>______________________________________________
>>[hidden email] 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.

______________________________________________
[hidden email] 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.