similar to: Filling out a data frame row by row.... slow!

Displaying 20 results from an estimated 10000 matches similar to: "Filling out a data frame row by row.... slow!"

2002 Feb 06
2
SFTP Status Bar..
This is the LAST version I plan on doing.. If I hear no feed back good or bad. Then I'll assume I've wasted my time on a feature that people whine about but don't care to try. This is against 3.0.2pX so it should be VERY easy for anyone to test. - Ben diff -ur openssh-3.0.2p1/misc.c openssh/misc.c --- openssh-3.0.2p1/misc.c Tue Jul 3 23:46:58 2001 +++ openssh/misc.c Wed Feb 6
2011 Jul 20
3
select element from each row of the matrix
I have a 5 column matrix like 12 10 8 6 3 10 9 8 7 5 14 NA 4 NA NA NA 15 NA 10 NA 5 ... I want to select the position of the first entry for each row <=5 for example, for the first row, I want to select the last element and return its position as 5; for th e third row, I want to select the third element and return its position as 3; similarly for the 4th row, I want to select the fifth
2008 Mar 10
2
write.table with row.names=FALSE unnecessarily slow?
write.table with large data frames takes quite a long time > system.time({ + write.table(df, '/tmp/dftest.txt', row.names=FALSE) + }, gcFirst=TRUE) user system elapsed 97.302 1.532 98.837 A reason is because dimnames is always called, causing 'anonymous' row names to be created as character vectors. Avoiding this in src/library/utils, along the lines of Index:
2012 Mar 16
3
Faster way to implement this search?
I am working on a simulation where I need to count the number of matches for an arbitrary pattern in a large sequence of binomial factors. My current code is for(indx in 1:(length(bin.05)-3)) if ((bin.05[indx] == test.pattern[1]) && (bin.05[indx+1] == test.pattern[2]) && (bin.05[indx+2] == test.pattern[3])) return.values$count.match.pattern[1] =
2013 Sep 02
3
Product of certain rows in a matrix
Hi, You could try: A<- matrix(unlist(read.table(text=" 1 2 3 4 5 6 7 8 9 9 8 7 6 5 4 3 2 1 ",sep="",header=FALSE)),ncol=3,byrow=FALSE,dimnames=NULL) library(matrixStats) ?res1<-t(sapply(split(as.data.frame(A),as.numeric(gl(nrow(A),2,6))),colProds)) ?res1 #? [,1] [,2] [,3] #1??? 4?? 10?? 18 #2?? 63?? 64?? 63 #3?? 18?? 10??? 4
2013 Sep 04
2
Random products of rows in a matrix
Hello everybody, Without any loop and any package, I would like to return N products of M rows in a matrix A : Today, I managed to do it with a loop : B <- matrix(NA, ncol = ncol(A), nrow = 0) for (i in 1 : N) B <- rbind(B, apply(A[sample(1 : nrow(A), M, replace = T), ], 2, prod)) Do you have a solution ? Thank you in advance ! [[alternative HTML version deleted]]
2008 Aug 18
2
matrix row product and cumulative product
I spent a lot of time searching and came up empty handed on the following query. Is there an equivalent to rowSums that does product or cumulative product and avoids use of apply or looping? I found a rowProd in a package but it was a convenience function for apply. As part of a likelihood calculation called from optim, I?m computing products and cumulative products of rows of matrices with
2007 Mar 02
5
extracting rows from a data frame by looping over the row names: performance issues
Hi, I have a big data frame: > mat <- matrix(rep(paste(letters, collapse=""), 5*300000), ncol=5) > dat <- as.data.frame(mat) and I need to do some computation on each row. Currently I'm doing this: > for (key in row.names(dat)) { row <- dat[key, ]; ... do some computation on row... } which could probably considered a very natural (and R'ish) way of
2007 Nov 26
2
colnames slow (PR#10470)
Full_Name: Tomas Larsson Version: 2.6.0 OS: Windows XP Submission from: (NULL) (198.208.251.24) This is not a bug, it is a performance issue but I think it should have an easy fix. I have a large matrix (about 2,000,000 by 20), when I type colnames(x) it takes a long time to get the result. However, if I select just the first couple of rows of the matrix I don't have to wait for the
2007 Dec 19
1
strange timings in convolve(x,y,type="open")
Dear R-ophiles, I've found something very odd when I apply convolve to ever larger vectors. Here is an example below with vectors ranging from 2^11 to 2^17. There is a funny bump up at 2^12. Then it gets very slow at 2^16. > for( i in 11:20 )print( system.time(convolve(1:2^i,1:2^i,type="o"))) user system elapsed 0.002 0.000 0.002 user system elapsed 0.373
2011 Feb 26
2
how to remove rows in which 2 or more observations are smaller than a given threshold?
Hello The data set I am examining has 7425 observations (rows with unique identifiers) and 46 samples(columns). I have been trying to generate a dataset that filters out observations that are "negligible" The definition of "negligible" is absolute value less or equal to 1.58. The rule that I would like to adopt to create a new data is: drop rows in which 2 or more
2007 Sep 19
3
Row-by-row regression on matrix
Folks, I have a 3000 x 4 matrix (y), which I need to regress row-by-row against a 4-vector (x) to create a matrix lm.y of intercepts and slopes. To illustrate: y <- matrix(rnorm(12000), ncol = 4) x <- c(1/12, 3/12, 6/12, 1) system.time(lm.y <- t(apply(y, 1, function(z) lm(z ~ x)$coefficient))) [1] 44.72 18.00 69.52 NA NA Takes more than a minute to do (and I need to do many
2013 Mar 18
4
Counting confidence intervals
Hi, I have a 2 x 10000 matrix of confidence intervals. The first column is the lower and the next column is the upper. I want to cont how many times a number say 12 lies in the interval. Can anyone assist? -- Thanks, Jim. [[alternative HTML version deleted]]
2013 Jun 18
1
transform 3 numeric vectors empty of 0/1
Dear all, Without a loop, I would like transform 3 numeric vectors empty of 0/1 of same length Vec1 : transform 1 to A and 0 to "" Vec2 : transform 1 to B and 0 to "" Vec3 : transform 1 to C and 0 to "" to obtain only 1 vector Vec who is the paste of the 3 vectors (Ex : ABC, BC, AC, AB,...) Any idea ? Thank you for your help -- Michel ARNAUD
2012 Feb 25
5
which is the fastest way to make data.frame out of a three-dimensional array?
foo <- rnorm(30*34*12) dim(foo) <- c(30, 34, 12) I want to make a data.frame out of this three-dimensional array. Each dimension will be a variabel (column) in the data.frame. I know how this can be done in a very slow way using for loops, like this: x <- rep(seq(from = 1, to = 30), 34) y <- as.vector(sapply(1:34, function(x) {rep(x, 30)})) month <- as.vector(sapply(1:12,
2011 Mar 02
1
merge( , by='row.names') slowness
I noticed that joining two data.frames in R using the "merge" function that using by='row.names' slows things down substantially when compared to just joining on a common index column. Using a dataframe size of ~10,000 rows: it's as slow as 10 minutes in the by='row.names' case versus merely 1 second using an index column. Beyond the 10^6 range, it's unusably
2013 Jun 26
3
match rows of R
Hi all, What would be an efficient way to match rows of a matrix to a vector? ex: m<-matrix(1:9, nrow=3) m [,1] [,2] [,3] [1,] 1 4 7 [2,] 2 5 8 [3,] 3 6 9 ################################# which(m==c(2,5,8)) # I want this to return 2 ###################### Thanks, Sachin [[alternative HTML version deleted]]
2010 Feb 12
1
paired wilcox test on each row of a large dataframe
hI I have to calculate V statistic for each row of a large dataframe (28000). I can not use multtest package for paired wilcox test. I have been using for loop which are. Is there a way to speed the computation with another method like using apply or tapply? My data set looks like this: 11573_MB 11911_MB 11966_MB 12091_MB 12168_MB 12420_MB................ cg00000292
2014 Nov 15
1
quantreg speed
Hi all, I'm using quantreg rq() to perform quantile regression on a large data set. Each record has 4 fields and there are about 18 million records in total. I wonder if anyone has tried rq() on a large dataset and how long I should expect it to finish. Or it is simply too large and I should subsample the data. I would like to have an idea before I start to run and wait forever. In addition,
2012 Dec 08
5
How to efficiently compare each row in a matrix with each row in another matrix?
Dear expeRts, I have two matrices A and B. They have the same number of columns but possibly different number of rows. I would like to compare each row of A with each row of B and check whether all entries in a row of A are less than or equal to all entries in a row of B. Here is a minimal working example: A <- rbind(matrix(1:4, ncol=2, byrow=TRUE), c(6, 2)) # (3, 2) matrix B <-