Re: [R] Operator proposal: %between%

2014-09-05 Thread William Dunlap
You can easily run into precedence problems with the %fun% syntax. E.g., if 1 %<% 5 %<% 10 returns TRUE then 1 %<% 5 %<% 10*2 will return 2 because %<% has higher precedence than *. > as.list(quote(1 %<% 5 %<% 10*2)) [[1]] `*` [[2]] 1 %<% 5 %<% 10 [[3]] [1]

Re: [R] Operator proposal: %between%

2014-09-05 Thread Hadley Wickham
> Please add it if you think it fits, and expand it as discussed, I am not > creating a package for one single utility function. Why not? There's nothing wrong with a package that only provides one function. Hadley -- http://had.co.nz/ __ R-help@r-p

Re: [R] Operator proposal: %between%

2014-09-05 Thread Duncan Murdoch
On 05/09/2014, 6:47 AM, Torbjørn Lindahl wrote: > I don't mind maintaining this, however I'm not creating a new util package > just for one function, there are already several nice util libraries out > there, adding one more adds to fragmentation more than this single function > provides usefulness

Re: [R] Operator proposal: %between%

2014-09-05 Thread Torbjørn Lindahl
I don't mind maintaining this, however I'm not creating a new util package just for one function, there are already several nice util libraries out there, adding one more adds to fragmentation more than this single function provides usefulness. If anyone wants to adopt this low-maintenance-cost lo

Re: [R] Operator proposal: %between%

2014-09-05 Thread Gabor Grothendieck
On Thu, Sep 4, 2014 at 10:41 AM, Torbjørn Lindahl wrote: > Not sure if this is the proper list to propose changes like this, if it > passes constructive criticism, it would like to have a %between% operator > in the R language. > There is a between function in the data.table package. > library(d

Re: [R] Operator proposal: %between%

2014-09-05 Thread Torbjørn Lindahl
Please add it if you think it fits, and expand it as discussed, I am not creating a package for one single utility function. T. On Fri, Sep 5, 2014 at 1:28 AM, David Winsemius wrote: > > On Sep 4, 2014, at 12:54 PM, Greg Snow wrote: > > > The TeachingDemos package has %<% and %<=% operators fo

Re: [R] Operator proposal: %between%

2014-09-05 Thread Barry Rowlingson
On Fri, Sep 5, 2014 at 12:28 AM, David Winsemius wrote: > If you are accepting feature requests The R issue tracker has a "wishlist" section: https://bugs.r-project.org/bugzilla3/buglist.cgi?component=Wishlist&order=changeddate%20DESC%2Cbug_status%2Cpriority%2Cassigned_to%2Cbug_id&product=R&que

Re: [R] Operator proposal: %between%

2014-09-04 Thread David Winsemius
On Sep 4, 2014, at 12:54 PM, Greg Snow wrote: > The TeachingDemos package has %<% and %<=% operators for a between > style comparison. So for your example you could write: > > 1 %<% 5 %<% 10 > > or > > 1 %<=% 5 %<=% 10 > > And these operators already work with vectors: > > lb %<=% x %<% ub

Re: [R] Operator proposal: %between%

2014-09-04 Thread Greg Snow
The TeachingDemos package has %<% and %<=% operators for a between style comparison. So for your example you could write: 1 %<% 5 %<% 10 or 1 %<=% 5 %<=% 10 And these operators already work with vectors: lb %<=% x %<% ub and can even be further chained: 0 %<% x %<% y %<% z %<% 1 # only poi

Re: [R] Operator proposal: %between%

2014-09-04 Thread Duncan Murdoch
On 04/09/2014 10:41 AM, Torbjørn Lindahl wrote: Not sure if this is the proper list to propose changes like this, if it passes constructive criticism, it would like to have a %between% operator in the R language. But it appears that you do: I currently have this in my local R startup script:

[R] Operator proposal: %between%

2014-09-04 Thread Torbjørn Lindahl
Not sure if this is the proper list to propose changes like this, if it passes constructive criticism, it would like to have a %between% operator in the R language. I currently have this in my local R startup script: `%between%` <- function(x,...) { y <- range( unlist(c(...)) ) return( x >= y