search for: bind_activation

Displaying 14 results from an estimated 14 matches for "bind_activation".

2015 Jan 24
3
Proper way to define cbind, rbind for s4 classes in package
...ot;ClassA", y = "ANY"), function(x, y) { # Do stuff ... }) setMethod("cbind2", signature(x="ClassA", y = "ANY"), function(x, y) { # Do stuff ... }) >From ?cbind2 I learned that these functions need to be activated using methods:::bind_activation to replace rbind and cbind from base. I included the call in the package file R/zzz.R using the .onLoad function: .onLoad <- function(...) { # Bind activation of cbind(2) and rbind(2) for S4 classes methods:::bind_activation(TRUE) } This works as expected. However, running R CMD check I am...
2012 Sep 12
1
methods cbind2 bind_activation disrupts cbind everywhere
The methods package ?cbind2 includes the instruction to use via methods:::bind_activation(TRUE). This changes the default definition of cbind globally, disrupting proper evaluation in packages not using cbind2. Is cbind2 a hold-over from a time when ... could not be used for dispatch? What is a safe way for a package to use cbind2? This came up in the context of complex package depe...
2015 Jan 26
2
Proper way to define cbind, rbind for s4 classes in package
.... well... yes and no. Think of using the Matrix package, maybe with another package that defines another generalized matrix class... It would be nice if things worked automatically / perfectly there. > The cBind and rBind functions in Matrix (and the r/cbind > that get installed by bind_activation, the code is shared) > work by recursing, dropping the first argument until two > are left, and then combining with r/cbind2(). The Biobase > package uses a similar strategy to mimic c() via its > non-standard combine() generic. The nice thing about the > combine(...
2015 Feb 09
2
Proper way to define cbind, rbind for s4 classes in package
...producible example, somehow? Thanks, Michael On Mon, Feb 9, 2015 at 2:28 PM, Mario Annau <mario.annau at gmail.com> wrote: > Hi Michael, > I've tested your change in r67699 (using r67773) and the function now > correctly dispatches to r/cbind2 within the R-session without > bind_activation(TRUE). However, running unit tests using R CMD check I > figured out that the same function call delegates to r/cbind.matrix > (function uses S4 class as first- and matrix as second argument). Is > this a bug and/or how can I get function dispatch right (to r/cbind2) > for my test cases...
2015 Feb 02
2
Proper way to define cbind, rbind for s4 classes in package
...maybe with another package that defines another >> generalized matrix class... It would be nice if things >> worked automatically / perfectly there. >> >> > The cBind and rBind functions in Matrix (and the >> r/cbind > that get installed by bind_activation, the code >> is shared) > work by recursing, dropping the first >> argument until two > are left, and then combining with >> r/cbind2(). The Biobase > package uses a similar strategy >> to mimic c() via its > non-standard combine() >> ge...
2015 Feb 20
1
Proper way to define cbind, rbind for s4 classes in package
...;>>>> Mario Annau <mario.annau at gmail.com> >>>>> on Wed, 11 Feb 2015 20:18:53 +0100 writes: > sorry - I just got irritated by my different R-versions. > The behaviour I described in the previous mail was discovered using R > 3.1.2 without bind_activation(TRUE). In r67773 all calls are delegated > to r/cbind.matrix and not r/cbind2. > As a workaround I have now implemented an S3 method for my S4 class > which correctly dispatches for both versions (3.1.2 and r67699+) - see > also the commit for the h5 package on github:...
2015 Feb 11
0
Proper way to define cbind, rbind for s4 classes in package
sorry - I just got irritated by my different R-versions. The behaviour I described in the previous mail was discovered using R 3.1.2 without bind_activation(TRUE). In r67773 all calls are delegated to r/cbind.matrix and not r/cbind2. As a workaround I have now implemented an S3 method for my S4 class which correctly dispatches for both versions (3.1.2 and r67699+) - see also the commit for the h5 package on github: https://github.com/mannau/h5/commit/2...
2015 Jan 24
0
Proper way to define cbind, rbind for s4 classes in package
...For example, we have a DataFrame object that mimics data.frame. To cbind a data.frame with a DataFrame, the user can just call the DataFrame() constructor. rbind() between different data structures is much less common. The cBind and rBind functions in Matrix (and the r/cbind that get installed by bind_activation, the code is shared) work by recursing, dropping the first argument until two are left, and then combining with r/cbind2(). The Biobase package uses a similar strategy to mimic c() via its non-standard combine() generic. The nice thing about the combine() approach is the user entry point and the ge...
2015 Feb 02
0
Proper way to define cbind, rbind for s4 classes in package
...Think of using the Matrix package, maybe > with another package that defines another generalized matrix class... > It would be nice if things worked automatically / perfectly there. > > > The cBind and rBind functions in Matrix (and the r/cbind > > that get installed by bind_activation, the code is shared) > > work by recursing, dropping the first argument until two > > are left, and then combining with r/cbind2(). The Biobase > > package uses a similar strategy to mimic c() via its > > non-standard combine() generic. The nice thing about t...
2015 Feb 09
0
Proper way to define cbind, rbind for s4 classes in package
Hi Michael, I've tested your change in r67699 (using r67773) and the function now correctly dispatches to r/cbind2 within the R-session without bind_activation(TRUE). However, running unit tests using R CMD check I figured out that the same function call delegates to r/cbind.matrix (function uses S4 class as first- and matrix as second argument). Is this a bug and/or how can I get function dispatch right (to r/cbind2) for my test cases? best, mario Am 0...
2008 Dec 03
1
reduce limit number of arguments in methods:::cbind
...S4 objects. The limitation would then be reduced to the number of consecutive S4 objects. ##### R code ##### dfr <- data.frame(matrix(0, nrow = 1 , ncol = 1000)) dfr2 <- is.na(dfr) mlist <- rep(list(matrix(0, 2, 1)), 400) cb1 <- do.call("cbind", c(mlist, mlist)) methods:::bind_activation(TRUE) dfr2 <- is.na(dfr) # fails cb2 <- do.call("cbind", mlist) # ok cb3 <- do.call("cbind", c(mlist, mlist)) # fails # This could be avoided by first checking that the arguments has no S4 # objects. If this is the case, the function falls back to the # internal cbind...
2007 Mar 20
1
cbind() & rbind() for S4 objects -- 'Matrix' package changes
...ively defined cbind() / rbind() functions however have typically remained invisible in the methods package [you can see them via methods:::cbind or methods:::rbind ] and have been ``activated'' --- replacing base::cbind / rbind --- only via an explicit or implicit call to methods:::bind_activation(TRUE) One reason I didn't dare to make them the default was that I noticed they didn't behave identically to cbind() / rbind() in all cases, though IIRC the rare difference was only in the dimnames returned; further, being entirely written in R, and recursive, they were slower than the mos...
2018 Apr 23
0
R 3.5.0 is released
...ntermediate results from (usually ill-advised) assignments in arguments to BUILTIN functions. Package C code using SET_NAMED may need to be revised. DEPRECATED AND DEFUNCT: * Sys.timezone(location = FALSE) is defunct, and is ignored (with a warning). * methods:::bind_activation() is defunct now; it typically has been unneeded for years. The undocumented 'hidden' objects .__H__.cbind and .__H__.rbind in package base are deprecated (in favour of cbind and rbind). * The declaration of pythag() in Rmath.h has been removed - the entry poin...
2018 Apr 23
0
R 3.5.0 is released
...ntermediate results from (usually ill-advised) assignments in arguments to BUILTIN functions. Package C code using SET_NAMED may need to be revised. DEPRECATED AND DEFUNCT: * Sys.timezone(location = FALSE) is defunct, and is ignored (with a warning). * methods:::bind_activation() is defunct now; it typically has been unneeded for years. The undocumented 'hidden' objects .__H__.cbind and .__H__.rbind in package base are deprecated (in favour of cbind and rbind). * The declaration of pythag() in Rmath.h has been removed - the entry poin...