search for: cbind2

Displaying 20 results from an estimated 25 matches for "cbind2".

Did you mean: cbind
2007 Apr 07
2
Rf_PrintValue problem with methods::show
...entation explicitly saying that it should work). Basically, Rf_PrintValue(obj) fails when 'obj' is an S4 object that should be printed using show() rather than print(). From the error message I'm guessing that the need to use show is detected correctly but then show is not found. "cbind2" in the code below is just a representative object, the same holds for the few other S4 objects I have tried. The following uses r-devel on i686-pc-linux-gnu, but the results are same with R 2.4.1 (with suitable changes to the R_ParseVector call). On powerpc Linux I get a segfault. $ RPROG=...
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 u...
2015 Jan 24
3
Proper way to define cbind, rbind for s4 classes in package
...proper-way-to-use-cbind-rbind-with-s4-classes-in-package. I have written a package using S4 classes and would like to use the functions rbind, cbind with these defined classes. Since it does not seem to be possible to define rbind and cbind directly as S4 methods (see ?cBind) I defined rbind2 and cbind2 instead: setMethod("rbind2", signature(x="ClassA", y = "ANY"), function(x, y) { # Do stuff ... }) setMethod("cbind2", signature(x="ClassA", y = "ANY"), function(x, y) { # Do stuff ... }) >From ?cbind2 I learned th...
2015 Feb 09
2
Proper way to define cbind, rbind for s4 classes in package
Are you able to create a reproducible 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 d...
2015 Feb 20
1
Proper way to define cbind, rbind for s4 classes in package
..., 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: > https://github.com/mannau/h5/commit/20daea37ade1a317458c8a1d03928f579e457f93....
2015 Feb 02
2
Proper way to define cbind, rbind for s4 classes in package
>>>>> Michael Lawrence <lawrence.michael at gene.com> >>>>> on Sun, 1 Feb 2015 19:23:06 -0800 writes: > I've implemented the proposed changes in > R-devel. Minimally tested, so please try it. It should > delegate to r/cbind2 when there is at least one S4 > argument and S3 dispatch fails (so you'll probably want to > add an S3 method for your class to introduce a conflict, > otherwise it will dispatch to cbind.data.frame if one of > the args is a data.frame). There may no longer be a need...
2015 Jan 26
2
Proper way to define cbind, rbind for s4 classes in package
...ckage using S4 classes and would like >> to use the functions rbind, cbind with these defined >> classes. >> >> Since it does not seem to be possible to define rbind and >> cbind directly as S4 methods (see ?cBind) I defined >> rbind2 and cbind2 instead: >> > This needs some clarification. It certainly is possible to > define cbind and rbind methods. The BiocGenerics package > defines generics for those and many methods are defined by > e.g. S4Vectors, IRanges, etc. The issue is that dispatch &g...
2008 Dec 22
2
... (dotMethods) and cbind/rbind: how to give the signature?
...s far as this: ### start example setClass ("cbtest", representation = representation (data = "data.frame"), prototype = prototype (data = data.frame (spc = I (matrix (rnorm (15) , 3, 5))) ) ) a <- new ("cbtest") a setMethod("cbind2", signature (x = "cbtest", y = "cbtest"), function (x, y){ x at data$spc <- cbind (x at data$spc, y at data$spc) x } ) setMethod("cbind2", signature (x = "cbtest", y = "missing"), fun...
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/20daea37ade1a317458c8a1d03928f579e457f93. Any better ideas are welcome. br, m...
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/...
2007 Mar 20
1
cbind() & rbind() for S4 objects -- 'Matrix' package changes
...s for these of course only dispatch on the first argument which is also not really satisfactory in the context of many possible matrix classes.] For this reason, after quite some discussion on R-core (and maybe a bit on R-devel) about the options, since R-2.2.0 we have had S4 generic functions cbind2() and rbind2() (and default methods) in R's "methods" which are a version of cbind() and rbind() respectively for two arguments (x,y) {and fixed 'deparse.level = 0' : the argument names are 'x' and 'y' and hence don't make sense to be used to construct c...
2015 Feb 02
0
Proper way to define cbind, rbind for s4 classes in package
I've implemented the proposed changes in R-devel. Minimally tested, so please try it. It should delegate to r/cbind2 when there is at least one S4 argument and S3 dispatch fails (so you'll probably want to add an S3 method for your class to introduce a conflict, otherwise it will dispatch to cbind.data.frame if one of the args is a data.frame). There may no longer be a need for cBind() and rBind(). Michael...
2015 Jan 24
0
Proper way to define cbind, rbind for s4 classes in package
...d-with-s4-classes-in-package. > > I have written a package using S4 classes and would like to use the > functions rbind, cbind with these defined classes. > > Since it does not seem to be possible to define rbind and cbind directly > as S4 methods (see ?cBind) I defined rbind2 and cbind2 instead: > This needs some clarification. It certainly is possible to define cbind and rbind methods. The BiocGenerics package defines generics for those and many methods are defined by e.g. S4Vectors, IRanges, etc. The issue is that dispatch on "..." is singular, i.e., you can only s...
2008 Dec 03
1
reduce limit number of arguments in methods:::cbind
...s/R/cbind.R (revision 47045) +++ methods/R/cbind.R (working copy) @@ -39,11 +39,10 @@ ## remove trailing 'NULL's: while(na > 0 && is.null(argl[[na]])) { argl <- argl[-na]; na <- na - 1 } if(na == 0) return(NULL) - if(na == 1) { - if(isS4(..1)) - return(cbind2(..1)) - else return(.Internal(cbind(deparse.level, ...))) - } + if (!any(aS4 <- unlist(lapply(argl, isS4)))) + return(.Internal(cbind(deparse.level, ...))) + if(na == 1) + return(cbind2(..1)) ## else : na >= 2 @@ -64,6 +63,15 @@ else { ## na >= 3 argumen...
2006 Sep 07
2
Matrix package in R-2.4.0alpha
...c), keep.source = keep.source) : in 'Matrix' methods specified for export, but none defined: BIC, anova, coef, confint, deviance, fitted, fixef, formula, head, lmer, logLik, mcmcsamp, plot, qqmath, ranef, residuals, resid, simulate, summary, tail, terms, update, vcov, VarCorr, with, cbind2, rbind2, Arith, Math, Math2, Summary, Compare, !, +, %*%, Schur, as.array, as.matrix, as.vector, band, chol, colMeans, colSums, coerce, crossprod, determinant, diag, dim, dimnames, dimnames<-, expand, expm, kronecker, image, isSymmetric, norm, rcond, rowMeans, rowSums, show, solve, t, tcrossprod...
2006 Sep 03
3
Merge list to list - as list
Dear all, #Last week, I asked about merge x and y as list. #Now I have a dataset with list of list like: x <- list(list(matrix(1:20, 5, 4),matrix(1:20, 5, 4)), list(matrix(1:20, 5, 4),matrix(1:20, 5, 4))) y <- list(list(c(1, -1, -1, 1, 1),c(1, 1, -1, -1, -1)), list(c(1, 1, 1, 1, 1),c(1, 1, -1, 1, -1))) x y #I need merge x and y, I have tried with list.uni <-
2018 Mar 22
0
[R-pkg-devel] Warning: rBind is deprecated
...hey have been deprecated, unfortunately *not* with a warning [which was a lapsus of mine]. The help page for these has started, for a long time now, as | cBind package:Matrix R Documentation | | Versions of 'cbind' and 'rbind' recursively built on cbind2/rbind2 | | Description: | | The base functions ?cbind? and ?rbind? are defined for an | arbitrary number of arguments and hence have the first formal | argument ?...?. For that reason, in the past S4 methods could | easily be defined for binding together matrices inheriting f...
2007 Jun 19
0
Augment 'Matrix' matrices
...() "work". But because it was a hack, and some people called it "horrible" rather than "sophisticated", we had to give it up. {well, the really compelling argument was an example of do.call(rbind, <list of length 1000>) which was *very* inefficient} Instead, cbind2() and rbind2() have been written a few R versions ago to be used as (S4) generic functions. --> help(cbind2) In 'Matrix', we also define cBind() and rBind() to be used as direct (n-argument) substitutes for cbind() or rbind(), respectively. Martin
2013 Jun 22
0
Sparse Matrices and glmnet
...apse=" +"))), data = train) model = cv.glmnet(X, train[,1], family = "binomial") print("glmnet model completed") predict(model,newx=test[,2:10], s="lambda.min") ###################################################### I get the error Error in as.matrix(cbind2(1, newx) %*% nbeta) : error in evaluating the argument 'x' in selecting a method for function 'as.matrix': Error in cbind2(1, newx) %*% nbeta : not-yet-implemented method for <data.frame> %*% <dgCMatrix> However, even converting test to a matrix does not help. E...
2016 May 10
1
recursion problem using do.call(rbind, list(..,<S4>,..))
...bind and ...:rbind functions}: If you read ?rbind carefully, you may have learned that rbind() and cbind() are able to deal with S4 "matrix-like" objects, via the hidden methods:::rbind / methods:::cbind functions where these recursively build on appropriate S4 methods for rbind2() / cbind2(). That is how cbind() and rbind() work nowadays for Matrix-package matrices. However, there is problem lurking from the above paragraph, and for experienced programmers / computer scientists that may even be obvious: recursion. A simple MRE (minimal reproducible example) for the problem seen wi...