Re: [Rd] can we override "if" in R?

2017-03-04 Thread Gábor Csárdi
Because the S3 class system is very informal. E.g. if you happen to have an `if.whatever` function, that will be automatically a method of your generic. Gabor On Sat, Mar 4, 2017 at 7:49 PM, Da Zheng wrote: > I'm just curious. Why making "if" generic is even more

Re: [Rd] Control statements with condition with greater than one should give error (not just warning) [PATCH]

2017-03-04 Thread Henrik Bengtsson
Here's a patch that enables the error if _R_CHECK_CONDITION_={1,true,TRUE,yes,YES}. $ svn diff Index: src/main/eval.c === --- src/main/eval.c (revision 72303) +++ src/main/eval.c (working copy) @@ -1851,9 +1851,19 @@ Rboolean

Re: [Rd] can we override "if" in R?

2017-03-04 Thread William Dunlap via R-devel
dplyr::translate_sql() redefines lots of functions, include "if", to translate from R syntax to SQL syntax. > dplyr::translate_sql(if ("mpg">25) "better" else "worse") CASE WHEN ('mpg' > 25.0) THEN ('better') ELSE ('worse') END Bill Dunlap TIBCO Software wdunlap tibco.com On Sat, Mar 4, 2017

Re: [Rd] can we override "if" in R?

2017-03-04 Thread Da Zheng
In my case, I create a new type of matrices and override matrix operations in R for these matrices. My goal is to make the system as transparent as possible, which means my system should execute the existing R code without modification. The problem is that when data is in my own vectors or

Re: [Rd] can we override "if" in R?

2017-03-04 Thread Michael Lawrence
I'm curious as to precisely why someone would want to do this. On Sat, Mar 4, 2017 at 11:49 AM, Da Zheng wrote: > I'm just curious. Why making "if" generic is even more dangerous? > > Best, > Da > > On Sat, Mar 4, 2017 at 1:22 PM, Gábor Csárdi >

Re: [Rd] Control statements with condition with greater than one should give error (not just warning) [PATCH]

2017-03-04 Thread Michael Lawrence
Is there really a need for these complications? Packages emitting this warning are broken by definition and should be fixed. Perhaps we could "flip the switch" in a test environment and see how much havoc is wreaked and whether authors are sufficiently responsive? Michael On Sat, Mar 4, 2017 at

Re: [Rd] Control statements with condition with greater than one should give error (not just warning) [PATCH]

2017-03-04 Thread Martin Maechler
> Henrik Bengtsson > on Fri, 3 Mar 2017 10:10:53 -0800 writes: > On Fri, Mar 3, 2017 at 9:55 AM, Hadley Wickham > wrote: >>> But, how you propose a warning-to-error transition >>> should be made without wreaking havoc?

Re: [Rd] can we override "if" in R?

2017-03-04 Thread Da Zheng
I'm just curious. Why making "if" generic is even more dangerous? Best, Da On Sat, Mar 4, 2017 at 1:22 PM, Gábor Csárdi wrote: > `!` is a generic, `if` is not. You can define an `if` that is generic, > but this might be even more dangerous > > ❯ `if` <- function(a,

Re: [Bioc-devel] question on bioconductor/package citation

2017-03-04 Thread Michael Lawrence
On Sat, Mar 4, 2017 at 6:13 AM, Dwivedi, Bhakti wrote: > Hi, > > > > I have a few general questions. With such a rigorous peer-review process > in place for new package submissions in Bioconductor, I was wondering if > there is a way to assess the package acceptance

Re: [Rd] can we override "if" in R?

2017-03-04 Thread Gábor Csárdi
`!` is a generic, `if` is not. You can define an `if` that is generic, but this might be even more dangerous ❯ `if` <- function(a, b, c) UseMethod("if") ❯ `if.default` <- function(a,b,c) base::`if`(a, b, c) ❯ `if.foo` <- function(a, b, c) FALSE ❯ a <- structure(42, class = "foo") ❯ if (a)

Re: [Rd] can we override "if" in R?

2017-03-04 Thread Da Zheng
Thanks. Can I override it for a specific class? I can do that for operators such as "!". For example, "!.fm" works for objects of the class "fm". It seems I can't do the same for "if". Best, Da On Sat, Mar 4, 2017 at 12:41 PM, Gábor Csárdi wrote: > You can. Perhaps

[Rd] can we override "if" in R?

2017-03-04 Thread Da Zheng
Hello, I heard we can override almost everything in R. Is it possible to override "if" keyword in R to evaluate my own object instead of a logical value? Thanks, Da __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Bioc-devel] question on bioconductor/package citation

2017-03-04 Thread Martin Morgan
On 03/04/2017 09:13 AM, Dwivedi, Bhakti wrote: Hi, I have a few general questions. With such a rigorous peer-review process in place for new package submissions in Bioconductor, I was wondering if there is a way to assess the package acceptance rate? One could summarize the number times the

[Bioc-devel] question on bioconductor/package citation

2017-03-04 Thread Dwivedi, Bhakti
Hi, I have a few general questions. With such a rigorous peer-review process in place for new package submissions in Bioconductor, I was wondering if there is a way to assess the package acceptance rate? The reason I asked, I want to include the Bioconductor package citation in my NIH