similar to: rbind() on zero row matrices is inconsistent

Displaying 20 results from an estimated 50000 matches similar to: "rbind() on zero row matrices is inconsistent"

2003 Jul 29
2
cbind/rbind inconsistency with NULL parameter (PR#3585)
R-Version: 1.7.1 (2003-06-16) OS: Debian/GNU Linux cbind and rbind handle NULL parameters inconsistently. Consider: > cbind() NULL > cbind(NULL) NULL And: > cbind(diag(x = 1, 1, 1)) [,1] [1,] 1 > cbind(NULL, diag(x = 1, 1, 1)) [,1] [1,] 1 These seem to indicate that NULL parameters will be ignored in any call to cbind and rbind. However: >
2012 May 01
2
rbind-ing numeric matrices
Good morning, I'm running into trouble rbind-ing numeric matrices with differing numbers of rows. In particular, there seem to be issues whenever a one-row numeric matrix is involved. Assume A is a numeric matrix with 1 row and Y columns and B is a numeric matrix with X rows and Y columns. Let C be the result of rbinding A and B. Then C is a numeric matrix with X + 1 rows and Y columns, only
2012 Feb 16
2
how to rbind matrices from different loops
Dear R experts, I am having difficulty using loops productively and would like to please ask for advice. 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,
2013 Mar 07
3
rbind a list of matrices
I have a large list of matrices and a vector that identifies the desired matrices that I would like to rbind. However, I am stuck on how to get this to work. I have written some code below to illustrate my problem: # 3 simple matrices a<-matrix(1:9,3,3) b<-matrix(10:18,3,3) c<-matrix(19:27,3,3) #this is the type of list of matrices I am dealing with
2003 Jul 30
0
cbind/rbind inconsistency with NULL parameter (PR#3595)
The R help for cbind/rbind states: > For `cbind' (`rbind'), vectors of zero length are ignored unless > the result would have zero rows (columns), for S compatibility. > (Zero-extent matrices do not occur in S and are not ignored in R.) I presume this means the S language as defined in the Blue Book ("The ^New S Language", Becker Chambers & Wilks,
2010 Oct 14
1
rbind ing matrices and resetting column numbers
Sorry for the verbose example. I want to row bind two matrices, and all works except I want the column labelled "row" to be sequential in the new matrix, shown as "mat3" here, i.e. needs to be 1:6 and not 1:3 repeated twice. Any suggestions? Thanks J > colnm1 <- c("row","ti","counti") > colnm2 <-
2013 Jan 02
2
rbind: inconsistent behaviour with empty data frames?
The rbind on empty and nonempty data frames behaves inconsistently. I am not sure if by design. In the first example, first row is deleted, which may or may not be on purpose: df1 <- data.frame() df2 <- data.frame(foo=c(1, 2), bar=c("a", "b")) rbind(df1, df2) foo bar 2 2 b Now if we continue: df1 <- data.frame(matrix(0, 0, 2)) names(df1) <- names(df2)
2008 Nov 16
1
inconsistency between timeSeries and zoo causing a problem with rbind
Dear R Users and maintainers of packages zoo and timeSeries, I believe there is a recently introduced inconsistency between timeSeries and zoo which is causing a problem with rbind. I had previously reported that I was having problems with rbind in the following code: library(zoo) foo<-zoo(1,order.by=as.Date("2007-10-09")) bar<-zoo(2,order.by=as.Date("2007-10-10"))
2009 Jan 07
5
rbind for matrices - rep argument
Dear R users,I'm facing a trivial problem, but I really can't solve it. I've tried a dozen of codes, but I can't get the result I want. The question is: I have a dataframe like this one [,1] [,2] [,3] [,4] [,5] [1,] 1 2 3 4 5 [2,] 2 5 5 4 9 [3,] 1 6 8 1 2 [4,] 8 6 4 1 5 made up of decimal numbers, of course. I want to
2011 Dec 01
1
strange row numbering after rbind-ing a list
"Not that it really matters, but" Can someone explain how the row numbers get assigned in the following sequence? It looks like something funky happens when rbind() coerces 'bar' into a dataframe. In either sequence of rbind below, once you get past the first two rows, the row numbers count normally. Rgames> (foo<-data.frame(x=5,y=4,r=3)) x y r 1 5 4 3 Rgames>
2011 Mar 23
1
rbind a heterogeneous row
I have a dataframe with many rows like this: > df X1 X2 X3 X4 X5 X6 X7 week d sim1 FALSE TRUE TRUE TRUE TRUE TRUE TRUE 1 0.3064985 sim1 is the rowname, X1..X7,week,d are the column names. X1..X7 are factors, booleans in this case. I need to add another row, represented by the following list: list(rep(T,7),5,0.0) -- i.e, TRUE in all boolean columns,
2009 Sep 29
2
rbind for a list
Dear All, I´m using the following code: all1<-gg2[[1]][[1]]; for(i in 1:48){ all1 <- rbind(all1,gg2[[i]][[1]]) } to create a new matrix that contains all the matrices in a list called gg2. gg2 is a list that looks like >> gg2 [[1]] [[1]][[1]] <matrix one> [[2]] [[2]][[1]] <matrix two> . . . [[48]] [[48]][[1]] <matrix 48> Is there a faster way to do the rbind?
2010 Aug 05
1
rbind on data.frame that contains a column that is also a data.frame
Hi, The following was already a topic on r-help, but after understanding what is going on, I think it fits better in r-devel. The problem is this: When a data.frame has another data.frame in it, rbind doesn't work well. Here is an example: -- > a=data.frame(x=1:10,y=1:10) > b=data.frame(z=1:10) > b$a=a > b z a.x a.y 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 5
2019 May 17
1
nrow(rbind(character(), character())) returns 2 (as documented but very unintuitive, IMHO)
Hi Martin, Thanks for chiming in. Responses inline. On Fri, May 17, 2019 at 12:32 AM Martin Maechler <maechler at stat.math.ethz.ch> wrote: > >>>>> Gabriel Becker > >>>>> on Thu, 16 May 2019 15:47:57 -0700 writes: > > > Hi Hadley, > > Thanks for the counterpoint. Response below. > > > On Thu, May 16, 2019 at 1:59
2007 Mar 05
3
Rbind with data frames -- column names question
As part of my work, I am trying to append matrices onto data frames. Naively I assumed that when rbinding a data.frame and matrix, the matrix would be coerced and appended, keeping the names from the data frame. Clearly, I am not fully understanding the process by which rbind works. Example code: > A<-data.frame(1,1,1); names(A)=letters[1:3] ; B<-matrix(0,2,3) > rbind(A,B)
2019 May 17
3
nrow(rbind(character(), character())) returns 2 (as documented but very unintuitive, IMHO)
Hi Herve, Inline. On Thu, May 16, 2019 at 4:45 PM Pages, Herve <hpages at fredhutch.org> wrote: > Hi Gabe, > > ncol(data.frame(aa=c("a", "b", "c"), AA=c("A", "B", "C"))) > # [1] 2 > > ncol(data.frame(aa="a", AA="A")) > # [1] 2 > > ncol(data.frame(aa=character(0),
2004 Mar 26
4
cbind/rbind fail on matrixes containing lists (PR#6702)
Today's R 1.9.0 beta: > m1 [,1] [,2] [,3] [,4] [1,] NA NA NA NA [2,] NA NA NA NA [3,] NA NA NA NA [4,] NA NA NA NA > class(m1[1,1]) [1] "list" > cbind(m1,m1) Error in cbind(...) : cannot create a matrix from these types > rbind(m1,m1) Error in rbind(...) : cannot create a matrix from these types > version _
2004 Jun 29
2
binding rows from different matrices
Hello list, I have 3 matrices with same dimension : > veca=matrix(1:25,5,5) > vecb=matrix(letters[1:25],5,5) > vecc=matrix(LETTERS[1:25],5,5) I would like to obtain a new matrix composed by alternating rows of these different matrices (row 1 of mat 1, row 1 of mat 2, row 1 of mat 3, row 2 of mat 1.....) I have found a solution to do it but it is not very pretty and I wonder if I
2011 Jan 06
5
How to join matrices of different row length from a list
Hi, I have several matrix in a list, for example: e [[1]] [,1] [,2] [1,] 1 3 [2,] 2 4 [[2]] [,1] [,2] [1,] 1 4 [2,] 2 5 [3,] 3 6 [[3]] [,1] [,2] [1,] 2 1 I would like to join them by column i.e. [,1] [,2] [,3] [,4][,5] [,6] [1,] 1 3 1 4 2 1 [2,] 2 4 2 5 NA NA [3,] NA NA 3 6 NA NA I have tried
2016 May 10
1
recursion problem using do.call(rbind, list(..,<S4>,..))
This was originally a bug report about Matrix, https://r-forge.r-project.org/tracker/?func=detail&atid=294&aid=6325&group_id=61 but the bug is rather a "design" bug in R, or a limitation. This e-mail is a report of the status quo as I see it, and call for comments, sugguests, help/hints for workarounds, or even a suggestion for a programming task helping R core to amend