Displaying 20 results from an estimated 3399 matches for "rbind".
Did you mean:
bind
2008 Nov 25
2
dots methods: dispatch issues
There seems to be a bug arising when using multiple S4 generics with "..."
as the signature.
The following code works as expected:
##############################################################
> setGeneric("rbind", function(..., deparse.level=1)
standardGeneric("rbind"),
+ signature = "...")
Creating a generic for "rbind" in package ".GlobalEnv"
(the supplied definition differs from and overrides the implicit generic
in package "base": S...
2013 Apr 29
3
rbinding some elements from a list and obtain another list
Hi everybody,
I have a list, where every element of this list is a data frame.
An example:
Mylist<-list(A=data.frame, B=data.frame, C=data.frame, D=data.frame)
I want to rbind some elements of this list.
As an example:
Output<-list(AB=data.frame, CD=data.frame)
Where
AB=rbind(A,B)
CD=rbind(C,D)
I’ve tried:
f<-function(x){
for (i in seq(1,length(names(x)),2)){
aa<-do.call(rbind,x[i:i+1])
aa
}}
bb<-f(mylist)
or
f<-func...
2005 Apr 29
0
handling of zero and negative indices in src/main/subscript.c:mat2indsub() (PR#7824)
...ue exceeds the
dimensions of the array being indexed). Here are examples of indexing
by matrices that do not return unequivocally sensible results (in most
cases):
> x <- matrix(1:6,ncol=2)
> dim(x)
[1] 3 2
> x
[,1] [,2]
[1,] 1 4
[2,] 2 5
[3,] 3 6
> x[rbind(c(1,1), c(2,2))]
[1] 1 5
> x[rbind(c(1,1), c(2,2), c(0,1))]
[1] 1 5
> x[rbind(c(1,1), c(2,2), c(0,0))]
Error: only 0's may be mixed with negative subscripts
> x[rbind(c(1,1), c(2,2), c(0,2))]
[1] 1 5 3
> x[rbind(c(1,1), c(2,2), c(0,3))]
Error: subscript out of bounds
> x[rbi...
2019 May 26
2
rbind has confusing result for custom sub-class (possible bug?)
Debugging this issue:
https://github.com/Rdatatable/data.table/issues/2008
We have custom class 'IDate' which inherits from 'Date' (it just forces
integer storage for efficiency, hence, I).
The concatenation done by rbind, however, breaks this and returns a double:
library(data.table)
DF = data.frame(date = as.IDate(Sys.Date()))
storage.mode(rbind(DF, DF)$date)
# [1] "double"
This is specific to base::rbind (data.table's rbind returns an integer as
expected); in ?rbind we see:
The method dispatching...
2012 Feb 16
2
how to rbind matrices from different loops
...I have a dataframe of ids and groups. I would like to
break down the dataframe into groups, find the unique sets of ids, then
reassemble. My thought was to use a loop, but I have been unable to finish
this loop in a logical way. I would like to find the unique ids for group
1, group 2, etc., and rbind these back together. However, I am unclear how
to do this because in other attempts my final product is always a part of
the last run loop. My way of working around this has been to write.csv and
then re read at the end, which is so clumsy. Previously, I have used a
store matrix for individual c...
2005 May 06
0
(PR#7824) handling of zero and negative indices in
...d). Here are examples of indexing
> by matrices that do not return unequivocally sensible results (in most
> cases):
>
> > x <- matrix(1:6,ncol=2)
> > dim(x)
> [1] 3 2
> > x
> [,1] [,2]
> [1,] 1 4
> [2,] 2 5
> [3,] 3 6
> > x[rbind(c(1,1), c(2,2))]
> [1] 1 5
> > x[rbind(c(1,1), c(2,2), c(0,1))]
> [1] 1 5
> > x[rbind(c(1,1), c(2,2), c(0,0))]
> Error: only 0's may be mixed with negative subscripts
> > x[rbind(c(1,1), c(2,2), c(0,2))]
> [1] 1 5 3
> > x[rbind(c(1,1), c(2,2), c(0,3))]
> E...
2010 Oct 26
1
S4 methods for rbind()
Hello.
I am trying to write an S4 method for rbind(). I have a class of objects
called 'mdm', and I want to be able to rbind() them to one another.
I do not want the method for rbind() to coerce anything to an mdm object.
I want rbind(x1,x2,x1,x2) to work as expected [ie rbind() should take any
number of arguments].
This is what I have so...
2005 Jan 21
6
how to use do.call("rbind", get(list(mlist)))
I have around 200 data frames I want to rbind in a vectorized way.
The object names are:
m302
m303
...
m500
So I tried:
mlist <- paste("m",302:500,sep="")
dat <- do.call("rbind", get(list(mlist)))
and I get "Error in get(x, envir, mode, inherits) : invalid first argument"
I know "rbind&q...
2019 May 26
2
rbind has confusing result for custom sub-class (possible bug?)
On Sun, May 26, 2019 at 4:06 AM Michael Chirico
<michaelchirico4 at gmail.com> wrote:
>
> Have finally managed to come up with a fix after checking out sys.calls()
> from within the as.Date.IDate debugger, which shows something like:
>
> [[1]] rbind(DF, DF)
> [[2]] rbind(deparse.level, ...)
> [[3]] `[<-`(`*tmp*`, ri, value = 18042L)
> [[4]] `[<-.Date`(`*tmp*`, ri, value = 18042L)
> [[5]] as.Date(value)
> [[6]] as.Date.IDate(value)
>
> I'm not sure why [<- is called, I guess the implementation is to assign to
&...
2010 Mar 15
1
rbind, data.frame, classes
Hi,
This has bugged me for a bit. First question is how to keep classes with
rbind, and second question is how to properly return vecotrs instead of
lists after turning an rbind of lists into a data.frame
list1=list(a=2, b=as.Date("20090102", format="%Y%m%d"))
list2=list(a=2, b=as.Date("20090102", format="%Y%m%d"))
rbind(list1, list2) #th...
2005 Apr 15
1
treatment of zero and negative elements in matrix indices
...ndices have no special meaning. There does seem
to be some range checking, but it's not consistent -- sometimes index
values that are out of range get through.)
> x <- matrix(1:6,ncol=2)
> dim(x)
[1] 3 2
> x
[,1] [,2]
[1,] 1 4
[2,] 2 5
[3,] 3 6
> x[rbind(c(1,1), c(2,2))]
[1] 1 5
> x[rbind(c(1,1), c(2,2), c(0,1))]
[1] 1 5
> x[rbind(c(1,1), c(2,2), c(0,0))]
Error: only 0's may mix with negative subscripts
> x[rbind(c(1,1), c(2,2), c(0,2))]
[1] 1 5 3
> x[rbind(c(1,1), c(2,2), c(0,3))]
Error: subscript out of bounds
> x[rbind(c(...
2007 Jul 17
2
poor rbind performance
Hi
I rbind data frames in a loop in a cumulative way and the performance
detriorates very quickly.
My code looks like this:
for( k in 1:N)
{
filename <- paste("/tmp/myData_",as.character(k),".txt",sep="")
myDataTmp <- read.table(filename,header=TRUE,sep=",...
2007 Mar 20
1
cbind() & rbind() for S4 objects -- 'Matrix' package changes
As some of you may have seen / heard in the past,
it is not possible to make cbind() and rbind() into proper S4
generic functions, since their first formal argument is '...'.
[ BTW: S3-methods 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...
2017 Jan 17
2
bug in rbind?
I suspect there may be a bug in base::rbind.data.frame
Below there is minimal example of the problem:
m <- matrix (1:12, 3)
dfm <- data.frame (c = 1 : 3, m = I (m))
str (dfm)
m.names <- m
rownames (m.names) <- letters [1:3]
dfm.names <- data.frame (c = 1 : 3, m = I (m.names))
str (dfm.names)
rbind (m, m.names)
rbind (m.nam...
2019 May 27
2
rbind has confusing result for custom sub-class (possible bug?)
...M Michael Chirico
> > <michaelchirico4 at gmail.com> wrote:
> > >
> > > Have finally managed to come up with a fix after checking out
> sys.calls()
> > > from within the as.Date.IDate debugger, which shows something like:
> > >
> > > [[1]] rbind(DF, DF)
> > > [[2]] rbind(deparse.level, ...)
> > > [[3]] `[<-`(`*tmp*`, ri, value = 18042L)
> > > [[4]] `[<-.Date`(`*tmp*`, ri, value = 18042L)
> > > [[5]] as.Date(value)
> > > [[6]] as.Date.IDate(value)
> > >
> > > I'm not s...
2015 Feb 02
2
Proper way to define cbind, rbind for s4 classes in package
...e 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
This sounds great! Thank you very much, Michael!
:-) :-)
... but .... :-( experiments with the Matrix package (and R
devel with your change), show a remaining buglet with treating of dimnames :
> M1 <- Matrix(m1 <- matrix(1:12, 3,4))
> cbind(m1, MM = -1)...
2003 Apr 21
3
index after rbind
I am using rbind to concatenate two dataframes, but after the rbind I get
a strange "double" index.
I am using rbind a number of times to make one large dataset. Is there a
way to prevent the "double" index? Or is there some other way to
concatenate the data (it looks like merge only works by...
2019 Jun 02
1
rbind has confusing result for custom sub-class (possible bug?)
I thought it would be good to summarize my thoughts, since I made a
few hypotheses that turned out to be false.
This isn't a bug in base R, in either rbind() or `[<-.Date`.
To summarize the root cause:
base::rbind.data.frame() calls `[<-` for each column of the
data.frame, and there is no `[<-.IDate` method to ensure the
replacement value is converted to integer. And, in fact, `[<-.Date`
calls as.Date() and data.table::as.Date.IDate() ca...
2015 Jan 26
2
Proper way to define cbind, rbind for s4 classes in package
...On Sat, Jan 24, 2015 at 12:58 AM, Mario Annau
> <mario.annau at gmail.com> wrote:
>> Hi all, this question has already been posted on
>> stackoverflow, however without success, see also
>> http://stackoverflow.com/questions/27886535/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
>> c...
2015 Feb 09
2
Proper way to define cbind, rbind for s4 classes in package
...ails (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
> >
> > This sounds great! Thank you very much, Michael!
> > :-) :-)
> >
> > ... but .... :-( experiments with the Matrix package (and R
> > devel with your change), show a remaining buglet with treating of
> dimnames...