similar to: How to modify dots and dispatch NextMethod

Displaying 20 results from an estimated 4000 matches similar to: "How to modify dots and dispatch NextMethod"

2018 Feb 22
2
How to modify dots and dispatch NextMethod
The example is invoking NextMethod via an anonymous function, which is not allowed (see documentation for NextMethod). Normally one gets a runtime error "'NextMethod' called from an anonymous function", but not here as the anonymous function is called via do.call. I will fix so that there is a runtime error in this case as well, thanks for uncovering this problem. I
2018 Feb 22
2
How to modify dots and dispatch NextMethod
On 02/22/2018 12:07 PM, I?aki ?car wrote: > 2018-02-22 10:29 GMT+01:00 Tomas Kalibera <tomas.kalibera at gmail.com>: >> The example is invoking NextMethod via an anonymous function, which is not >> allowed (see documentation for NextMethod). > Thanks for your response. I definitely missed that bit. > >> Normally one gets a runtime >> error
2018 Feb 21
0
How to modify dots and dispatch NextMethod
I've set up a repo with a reproducible example of the issue described in my last email: https://github.com/Enchufa2/dispatchS3dots I?aki 2018-02-20 19:33 GMT+01:00 I?aki ?car <i.ucar86 at gmail.com>: > Hi all, > > Not sure if this belongs to R-devel or R-package-devel. Anyways... > > Suppose we have objects of class c("foo", "bar"), and there are two
2018 Feb 22
0
How to modify dots and dispatch NextMethod
2018-02-22 12:39 GMT+01:00 Tomas Kalibera <tomas.kalibera at gmail.com>: > On 02/22/2018 12:07 PM, I?aki ?car wrote: >> >> 2018-02-22 10:29 GMT+01:00 Tomas Kalibera <tomas.kalibera at gmail.com>: >>> >>> The example is invoking NextMethod via an anonymous function, which is >>> not >>> allowed (see documentation for NextMethod).
2018 Jan 22
2
How to address the following: CRAN packages not using Suggests conditionally
Re-sending, since I forgot to include the list, sorry. I'm including r-package-devel too this time, as it seems more appropriate for this list. El 22 ene. 2018 10:11, "I?aki ?car" <i.ucar86 at gmail.com> escribi?: > > > El 22 ene. 2018 8:12, "Ulrich Bodenhofer" <bodenhofer at bioinf.jku.at> > escribi?: > > Dear colleagues, dear members of
2018 Jan 22
1
How to address the following: CRAN packages not using Suggests conditionally
On 01/22/2018 08:40 AM, Ulrich Bodenhofer wrote: > Thanks a lot, I?aki, this is a perfect solution! I already implemented > it and it works great. I'll wait for 2 more days before I submit the > revised package to CRAN - in order to give others to comment on it. It's very easy for 'pictures of code' (unevaluated code chunks in vignettes) to drift from the actual
2010 Feb 14
1
NextMethod() example from S Programming by Venables and Ripley (page 78)
S Programming by Venables and Ripley (page 78) has the example listed at the end of this email. However, I get the following error when I try the example. I don't understand the descriptions of NextMethod on its help page. Could somebody let me know how to fix the error of this example? > test(x) c1 c2 Error in NextMethod() : no method to invoke Calls: test -> test.c1 -> NextMethod
1999 Apr 16
1
NextMethod
>> One clear moral seems to be don't do anything more inside a >> generic function than you really need to do. Keep it *very* >> simple indeed. >> > I recall JMC saying something like, all generic functions > should be one line long; a call to the appropriate UseMethod. It certainly is encouraging to know that others also have been confused by aspects of
2012 Oct 17
1
Do *not* pass '...' to NextMethod() - it'll do it for you; missing documentation, a bug or just me?
Hi, although I've done S3 dispatching for more than a decade now, I think I managed to overlook/avoid the following pitfall when using NextMethod(): If you explicitly pass argument '...' to NextMethod(), you will effectively pass those argument twice to the "next" method! EXAMPLE: foo0 <- function(...) UseMethod("foo0"); foo1 <- function(...)
2006 Apr 14
3
The object argument of NextMethod.
My question is when the object argument of NexthMethod be used? In the following example, weather object argument is used will not affects the result. ### foo=function(x) {UseMethod("foo")} foo.cls1=function(x) { x=x+1;class(x)<-"ncls" NextMethod() } foo.ncls=function(x) { cat("ncls\n") } foo.cls2=function(x) { cat("cls2\n");print(x) }
2019 Aug 07
1
NextMethod() and argument laziness
Hi all, I'd like to ask if the following behavior is a bug. To me it certainly feels surprising, at the very least. In this example, I would like to call NextMethod() from my `child` object, have `cols` be left untouched, and then substitute(cols) in the parent method. It works when you use a `parent` object (as expected), but I would have also expected to get `mpg` back when calling it from
2005 Dec 21
3
NextMethod causes R 2.2.0 to crash (PR#8416)
I found writing the following default method the for the generic function "julian" causes R to crash. julian.default <- function(x, ...) { x <- as.Date(x) NextMethod("julian", x, ...) } Here is a test example > m <- as.Date("1972-09-27") + 0:10 > m [1] "1972-09-27" "1972-09-28" "1972-09-29"
1998 Jan 03
1
R-beta: NextMethod(.Generic) bug
I'm a day-old R newbie (but a war-weary S veteran), with couple of first-day questions: In R 0.61, this code fails. Ops.test <- function(e1,e2) { e1 <- NextMethod(.Generic) e1 } x <- 4 class(x) <- "test" y <- x < 3 The error message is "Error in NextMethod(.Generic) : negative length vectors are not allowed.". I assume it is a bug.
2010 Apr 27
1
suggestion on method dispatch
Dear all, I have define a function and its methods as follows: ######## beginning of code fn <- function(x,...){ UseMethod("fn") } fn.foo1 <- function(x, commonA=1, ...){ print("fn.foo1 is called.") } fn.foo2 <- function(x, uniqueFoo2, common=1, ...){ ## uniqueFoo2 is a unique argument in fn.foo2 x <- uniqueFoo2; class(x) <- "foo1" ## use uniqueFoo2
2012 Sep 02
1
Environment when NextMethod is used
I'm running into some hard-to-understand behavior with the evaluation environment when NextMethod is used. I'm using square-bracket indexing into objects, and the evaluation environment of the expression inside the square brackets seems to change depending on what kind of comparison operators are used. This behavior happens when the following conditions are met (this is what I've
2018 Jun 08
6
Subsetting the "ROW"s of an object
Hi all, Is there a better to way to subset the ROWs (in the sense of NROW) of an vector, matrix, data frame or array than this? subset_ROW <- function(x, i) { nd <- length(dim(x)) if (nd <= 1L) { x[i] } else { dims <- rep(list(quote(expr = )), nd - 1L) do.call(`[`, c(list(quote(x), quote(i)), dims, list(drop = FALSE))) } } subset_ROW(1:10, 4:6) #> [1] 4 5 6
2010 Apr 23
0
dot dot dot and NextMethod
Hello, Within the development of a package, I would need to build a specific method for the "pmin" function. I first make "pmin" generic pmin <- function (..., na.rm = FALSE) UseMethod("pmin") pmin.default <- base::pmin Now, within my new method, I would like to change the arguments in . (dot dot dot) before sending it to the NextMethod.
1997 Dec 02
1
R-alpha: NextMethod in 0.50-a4
I am encountering difficulty with NextMethod in 0.50-a4. We created a class of groupedData objects which are data.frames with additional attributes. The most important attribute is a formula describing roles of some of the variables in the experimental design. The class of such objects ends in "groupedData", "data.frame". The print method for the groupedData class simply
2017 Dec 17
2
Dialect for shell scripts
Dear all, During a recent package submission, we were highlighted that some lines in our configure script didn't follow the correct syntax. The lines looked like this: x=$(($y/10)) We were indicated at the time that this is because the statement does not use Bourne shell syntax, which is absolutely true, and also that the manual warns about this, which is true again. So far everything
2017 Nov 30
3
binary form of is() contradicts its unary form
2017-11-30 14:13 GMT+01:00 Suzen, Mehmet <mehmet.suzen at gmail.com>: > On 30 November 2017 at 14:04, I?aki ?car <i.ucar86 at gmail.com> wrote: >> >> Am I supposed to read every reference on a man page just to know what >> to expect from a function? >> > > If the reference is from John Chamber, you are supposed to read it. As a joke, it's funny.