similar to: rbind-ing numeric matrices

Displaying 20 results from an estimated 10000 matches similar to: "rbind-ing numeric matrices"

2010 Mar 24
2
translating SQL statements into data.table operations
I've recently stumbled across data.table, Matthew Dowle's package. I'm impressed by the speed of the package in handling operations with large data.frames, but am a bit overwhelmed with the syntax. I'd like to express the SQL statement below using data.table operations rather than sqldf (which was incredibly slow for a small subset of my financial data) or import/export with a
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 <-
2010 May 20
1
sqldf: issues with natural joins
Hello, I'm having trouble discovering what's going wrong with my use of natural joins via sqldf. Following the instructions under 4i at http://code.google.com/p/sqldf/, which discusses creating indices to speed joins, I have been only unreliably able to get natural joins to work. For example, > Tid <- c('AES 01-01-02 10:58:00', 'AES 01-01-02 11:53:00', 'AES
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)
2006 May 10
2
problem rbind after lapply (difference between 2.2.1 and 2.3.0)
Any help on the following would be appreciated... > R.version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 2.1 year 2005 month 12 day 20 svn rev 36812 > language R > set.seed(2) > x=matrix(ncol=4, nrow=10) > for(i in 1:4) x[,i]=rnorm(10) > x=as.data.frame(x) > x$V1=c(rep(0,5), rep(1,5)) >
2005 May 05
2
efficient filtering of matrices
I was wondering if someone can tell me the best way to search through a matrix and choose certain rows (based on certain conditions) to put into a separate matrix. What I have tried so far is very slow for a large dataset I'm working with. e.g., I have this piece of code to create a new matrix (newmat) based on my filtering conditions. Do I need to do this kind of thing where I keep
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>
2007 Jan 30
2
rbind-ing list
hi, i have a list of data.frame that has same structure. i would like to know a efficient way of rbind-ing it. right now, i write: n = length(temp) # 'temp' is a list of data.frames temp2 = data.frame() for (i in 1:n) temp2 = rbind( temp2, temp[[i]]) return(temp2) but this is not an efficient way since we keeping overwriting temp2. i wonder if there's faster way. thanks --
2007 Jan 25
4
rbind-ing with empty data frame produces error
Hi all, I'm having some trouble with rbind - this may be a bug or it may be my misunderstanding. If I do fileName <- paste(tempdir(),"test.txt",sep="/") file.create(fileName) x <- read.table(fileName, col.names=c("one","two","three")) I get a data frame with no rows, as documented. If I then try to rbind this with another data frame
2007 Dec 26
2
Rbind-ing a list into one item
Hi, I am doing the following: 1. I have a list of files.. Files1=list.files("some directory",pattern="some pattern") 2. I define a list as res=vector("list", length(files1)) 3. I read all the files into this list: res=lapply(files1, read.csv) I now want to rowbind all the items in the list into one big mass (all files have same number of columns). I tried
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
2009 Feb 12
5
Extending each element in a list, or rbind()-ing arrays of different length without recycling
Hi, I'm trying to take a matrix such as [,1] [,2] [,3] [,4] [,5] [1,] 2 7 2 7 9 [2,] 10 10 6 8 6 [3,] 1 9 7 2 0 and generate a new matrix which contains only the unique values in each row: [,1] [,2] [,3] [,4] [,5] [1,] 2 7 9 NA NA [2,] 10 6 8 NA NA [3,] 1 9 7 2 0 My problem is that I can use
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=",") if( k == 1) { myData <- myDataTmp } else{ myData
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,
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
2006 Nov 07
0
rbind with auto-row-named data.frame + list (PR#9346)
There's a problem new to R2.4.0 when rbinding an auto-row-named data.frame to a list: > rbind( data.frame( x=1), list( x=2)) Error in attr(value, "row.names") <- rlabs : row names must be 'character' or 'integer', not 'double' Works OK with 2 data.frames or 2 lists. Mark Bravington CSIRO Mathematical & Information Sciences Marine
2004 Aug 03
3
dots expansion
Hi list, I'm trying to write a function similar to rbind, except that needs to add a factor to each component array before rbinding them together so that the rows from different arrays are distinguishable. The problem that arose is how to loop through arguments in the dots "..." list. I need to get a hand on each of them but don't know how many of them there are and what
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
2006 Dec 08
2
any way to make the code more efficient ?
The code bekow works so this is why I didn't include the data to reproduce it. The loops about 500 times and each time, a zoo object with 1400 rows and 4 columns gets created. ( the rows represent minutes so each file is one day worth of data). Inside the loop, I keep rbinding the newly created zoo object to the current zoo object so that it gets bigger and bigger over time. Eventually,
2006 Aug 17
1
Multiple templates and domains
My apologies for those are going to get this email twice. I posted it earlier to what was the wrong mailing list earlier. Rails newbie here so forgive the question if the answer is ridiculously obvious. I am trying to write an app that meets the following requirements. I''d like to do it in Rails, but having pored over documentation for that past couple of days, don''t even