similar to: valaddin (0.1.0): Make your functions more robust

Displaying 20 results from an estimated 9000 matches similar to: "valaddin (0.1.0): Make your functions more robust"

2017 Oct 03
0
nofrills: Low-Cost Anonymous Functions
Dear R Users, nofrills (0.2.0) has been published on CRAN: https://cran.r-project.org/package=nofrills This lightweight package provides `fn()`, a compact variation of the usual syntax of function declaration, in order to support tidyverse-style quasiquotation of a function?s arguments and body. Aside from enabling a shorter but fully general syntax for function declarations, the main benefit
2019 Mar 07
0
stopifnot
By not using 'withCallingHandler' or 'tryCatch', the state is like 'stopifnot' in R 3.4.x. If 'stopifnot' becomes faster than in R 3.4.x when the expressions given to 'stopifnot' are all TRUE, it is because 'match.call' is not called. Credit is to https://github.com/HenrikBengtsson/Wishlist-for-R/issues/70 for the idea. Speaking about
2019 Apr 14
0
stopifnot
In current definition of function 'stopifnot' in stop.R in R 3.6.0 beta (https://svn.r-project.org/R/branches/R-3-6-branch/src/library/base/R/stop.R) or R devel (https://svn.r-project.org/R/trunk/src/library/base/R/stop.R), if 'exprs' is specified, cl[[1]] is quote(stopifnot) . To be more robust, quote(base::stopifnot) may be used instead. Also, in current definition of function
2019 Mar 31
3
stopifnot
Ah, with R 3.5.0 or R 3.4.2, but not with R 3.3.1, 'eval' inside 'for' makes compiled version behave like non-compiled version. options(error = expression(NULL)) library(compiler) enableJIT(0) f <- function(x) for (i in 1) {x; eval(expression(i))} f(is.numeric(y)) # Error: object 'y' not found fc <- cmpfun(f) fc(is.numeric(y)) # Error: object 'y' not found
2017 May 15
0
stopifnot() does not stop at first non-TRUE argument
Hi, On 05/15/2017 10:41 AM, luke-tierney at uiowa.edu wrote: > This is getting pretty convoluted. > > The current behavior is consistent with the description at the top of > the help page -- it does not promise to stop evaluation once the first > non-TRUE is found. That seems OK to me -- if you want sequencing you > can use > > stopifnot(A) > stopifnot(B) > > or
2017 May 16
0
stopifnot() does not stop at first non-TRUE argument
On Tue, 16 May 2017, Martin Maechler wrote: >>>>>> Herv? Pag?s <hpages at fredhutch.org> >>>>>> on Mon, 15 May 2017 16:54:46 -0700 writes: > > > Hi, > > On 05/15/2017 10:41 AM, luke-tierney at uiowa.edu wrote: > >> This is getting pretty convoluted. > >> > >> The current behavior is consistent
2019 Feb 27
1
stopifnot
My points: - The 'withCallingHandlers' construct that is used in current 'stopifnot' code has no effect. Without it, the warning message is the same. The overridden warning is not raised. The original warning stays. - Overriding call in error and warning to 'cl.i' doesn't always give better outcome. The original call may be "narrower" than 'cl.i'. I
2019 Jan 05
1
unsorted - suggestion for performance improvement and ALTREP support for POSIXct
I believe the performance of isUnsorted() in sort.c could be improved by calling REAL() once (outside of the for loop), rather than calling it twice inside the loop. As an aside, it is implemented in the faster way in doSort() (sort.c line 401). The example below shows the performance improvement for a vectors of double of moving REAL() outside the for loop. # example as implemented in
2019 May 30
2
stopifnot
Here is a patch to function 'stopifnot' that adds 'evaluated' argument and makes 'exprs' argument in 'stopifnot' like 'exprs' argument in 'withAutoprint'. --- stop.R 2019-05-30 14:01:15.282197286 +0000 +++ stop_new.R 2019-05-30 14:01:51.372187466 +0000 @@ -31,7 +31,7 @@ .Internal(stop(call., .makeMessage(..., domain = domain))) }
2019 Mar 05
0
stopifnot
>>>>> Suharto Anggono Suharto Anggono >>>>> on Tue, 5 Mar 2019 17:29:20 +0000 writes: > Another possible shortcut definition: > assert <- function(exprs) > do.call("stopifnot", list(exprs = substitute(exprs), local = parent.frame())) Thank you. I think this is mostly a matter of taste, but I liked your version using eval()
2019 Jun 03
0
stopifnot
>>>>> Suharto Anggono Suharto Anggono >>>>> on Thu, 30 May 2019 14:45:22 +0000 writes: >>>>> Suharto Anggono Suharto Anggono >>>>> on Thu, 30 May 2019 14:45:22 +0000 writes: > Here is a patch to function 'stopifnot' that adds 'evaluated' argument and makes 'exprs' argument in 'stopifnot'
2019 Feb 24
1
stopifnot
>From https://github.com/HenrikBengtsson/Wishlist-for-R/issues/70 : ... and follow up note from 2018-03-15: Ouch... in R-devel, stopifnot() has become yet 4-5 times slower; ... which is due to a complete rewrite using tryCatch() and withCallingHandlers(). >From https://stat.ethz.ch/pipermail/r-devel/2017-May/074256.html , it seems that 'tryCatch' was used to avoid the following
2017 May 16
2
stopifnot() does not stop at first non-TRUE argument
>>>>> Herv? Pag?s <hpages at fredhutch.org> >>>>> on Mon, 15 May 2017 16:54:46 -0700 writes: > Hi, > On 05/15/2017 10:41 AM, luke-tierney at uiowa.edu wrote: >> This is getting pretty convoluted. >> >> The current behavior is consistent with the description at the top of >> the help page -- it does not
2017 May 15
0
stopifnot() does not stop at first non-TRUE argument
>>>>> peter dalgaard <pdalgd at gmail.com> >>>>> on Mon, 15 May 2017 16:28:42 +0200 writes: > I think Herv?'s idea was just that if switch can evaluate arguments selectively, so can stopifnot(). But switch() is .Primitive, so does it from C. if he just meant that, then "yes, of course" (but not so interesting). > I think it is
2017 May 16
0
stopifnot() does not stop at first non-TRUE argument
> On 16 May 2017, at 18:37 , Suharto Anggono Suharto Anggono via R-devel <r-devel at r-project.org> wrote: > > switch(i, ...) > extracts 'i'-th argument in '...'. It is like > eval(as.name(paste0("..", i))) . Hey, that's pretty neat! -pd > > Just mentioning other things: > - For 'n', > n <- nargs() > can be used.
2018 Apr 01
0
Mention the case of logical(0) in ?stopifnot
I wonder if it would be helpful to mention in ?stopifnot that stopifnot(logical(0)) does not give an error (for background on why this is the case, see [1]). For example, ?all explicitly mentions the following: That all(logical(0)) is true is a useful convention and includes an example: all(logical(0)) # true, as all zero of the elements are true. I think it would be nice to give examples
2006 Mar 01
1
stopifnot() suggestion
If an expression is passed to stopifnot() which contains missing values, then the resulting error message is somewhat baffling until you are used to it, e.g. > x <- y <- rep(TRUE, 10) > y[7] <- NA > stopifnot(x, y) Error in if (!(is.logical(r <- eval(ll[[i]])) && all(r))) stop(paste(deparse(mc[[i + : missing value where TRUE/FALSE needed A minor change to
2007 Dec 07
0
regression tests for unlink and wildcards fail - Solaris 10 SPARC / Sun Studio 12 (PR#10501)
Full_Name: Jim Brown Version: 2.6.0 / 2.6.1 OS: Solaris 10 (SPARC) Submission from: (NULL) (35.8.15.102) I have been able to successfully compile version 2.5.1 using the Sun Studio 12 compilers on Sun Solaris 10 (SPARC). All tests using "make check" pass with a status of OK. However, the following section of "reg-tests-1.R" fails when I attempt to test after a build of
2017 May 15
0
stopifnot() does not stop at first non-TRUE argument
>>>>> Serguei Sokol <sokol at insa-toulouse.fr> >>>>> on Mon, 15 May 2017 13:14:34 +0200 writes: > I see in the archives that the attachment cannot pass. > So, here is the code: [....... MM: I needed to reformat etc to match closely to the current source code which is in
2017 May 03
0
stopifnot() does not stop at first non-TRUE argument
The first line of stopifnot is n <- length(ll <- list(...)) which takes ALL arguments and forms a list of them. This implies evaluation, so explains the effect that you see. To do it differently, you would have to do something like dots <- match.call(expand.dots=FALSE)$... and then explicitly evaluate each argument in turn in the caller frame. This amount of nonstandard