search for: rowmaxs

Displaying 16 results from an estimated 16 matches for "rowmaxs".

2010 Mar 29
1
Suggestion: Adding quick rowMin and rowMax functions to base package
Hi, I wonder whether similarly to the very quick rowSums and colSums functions in the base package, one could add quick functions that calculate the min or max over rows / cols in a matrix. While apply(x,1,min) works, I found out by profiling a program of mine that it is rather slow for matrices with a very large number of rows. A quick functionality seems to be already there in the
2007 Mar 03
0
2 bugs in max.col() (PR#9542)
Dear R-Developers, I think I found two bugs in max.col(). Ties between zeros are not broken, which might affect simulations. -Inf and Zero can be treated the same, which can give completely wrong results, e.g. when the second max is sought by replacing all maxs by -Inf. To fix max.col I do offer the C-code behind my function rowMax(), which also handles NAs and seems to be faster. However,
2009 Sep 19
1
matrix operations on grobs and grid units
Dear list, As a minimal test of a more complex grid layout, I'm trying to find a clean and efficient way to arrange text grobs in a rectangular layout. The labels may be expressions, or text with a fontsize different of the default, which means that the cell sizes should probably be calculated using grobWidth() and grobHeight() as opposed to simpler stringWidth() and stringHeight().
2012 Apr 19
4
Column(row)wise minimum and maximum
Hi, Currently, the "base" has colSums, colMeans. It seems that it would be useful to extend this to also include colMin, colMax (of course, rowMin and rowMax, as well) in order to facilitate faster computations for large vectors (compared to using apply). Has this been considered before? Please forgive me if this has already been discussed before. Thanks, Ravi Ravi Varadhan, Ph.D.
2011 Feb 15
1
matrixStats: Extend to arrays too (Was: Re: Suggestion: Adding quick rowMin and rowMax functions to base package)
Hi. On Sun, Feb 13, 2011 at 10:18 AM, TakeoKatsuki <takeo.katsuki at gmail.com> wrote: > > Hi Henrik, > > It would be nice if functions of the matrixStats package can handle array > data. > For example, rowSums() of the base package sums along the third axis of an > array by rowSums(x, dim=2). That is a good idea. This was indeed the initial objective before starting
2018 Feb 20
0
Take the maximum of every 12 columns
It looks like OP uses a data.frame, so in order to use matrixStats (I'm the author) one would have to pay the price to coerce to a matrix before using matrixStats::rowMaxs(). However, if it is that the original data could equally well live in a matrix, then matrixStats should be computational efficient for this task. (I've seen cases where an original matrix was turned into a data.frame just because that is what is commonly used elsewhere and because the user m...
2018 Feb 20
2
Take the maximum of every 12 columns
...nsistent and fast:? ?library(matrixStats) x <- matrix(runif(12e6), ncol=12) system.time(r1 <- do.call(pmax,as.data.frame(x))) ## user system elapsed ## 0.109 0.000 0.109 system.time(r2 <- apply(x,1,max)) ## user system elapsed ## 1.292 0.024 1.321 system.time(r3 <- rowMaxs(x)) ## user system elapsed ## 0.044 0.000 0.044 ? ?pmax is a fine alternative? for max special case. Best, Ista > > Cheers, > Bert > > > > Bert Gunter > > "The trouble with having an open mind is that people keep coming along and > sticking things in...
2011 Mar 02
2
*** caught segfault *** when using impute.knn (impute package)
hi, i am getting an error when calling the impute.knn function (see the screenshot below). what is the problem here and how can it be solved? screenshot: ################## *** caught segfault *** address 0x513c7b84, cause 'memory not mapped' Traceback: 1: .Fortran("knnimp", x, ximp = x, p, n, imiss = imiss, irmiss, as.integer(k), double(p), double(n), integer(p),
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 <-
2009 Jun 22
5
Convert "ragged" list to matrix
Hi, I have a list made up of character strings with each item a different length (each item is between 1and 6 strings long). Is there a way to convert a "ragged" list to a matrix such that each item is its own row? Here is a simple example: a=list(); a[[1]] = c("a", "b", "c"); a[[2]] = c("d", "e"); a[[3]] = c("f",
2008 Feb 10
2
View() + "End" key on Ubuntu=segfault
I can repeatably crash R (segfault) by doing n <- 10 z <- data.frame(a=1:n,b=1:n) View(z) and then hitting the "End" key on my keyboard. I haven't got debugging going yet, but running under gdb (without debugging symbols) does give this: 0xb7b63583 in strlen () from /lib/tls/i686/cmov/libc.so.6 R version 2.6.2 (2008-02-08) i486-pc-linux-gnu [Ubuntu Gutsy] locale:
2002 Jan 28
4
Functions on matrix row level
Hi together, I have some data in a matrix structure - say 1000 rows with 10 columns. And I like to do some calculations (like max, avg or min) on row level. The only solution I found so fare was using a loop like for (i in 1:1000) { max[i] <- max(matrix[I,]) } It looks like that this is not very fast. Does an other way exists? Kind regards Ulrich
2018 Feb 20
0
Take the maximum of every 12 columns
Ista, et. al: efficiency? (Note: I needed to correct my previous post: do.call() is required for pmax() over the data frame) > x <- data.frame(matrix(runif(12e6), ncol=12)) > system.time(r1 <- do.call(pmax,x)) user system elapsed 0.049 0.000 0.049 > identical(r1,r2) [1] FALSE > system.time(r2 <- apply(x,1,max)) user system elapsed 2.162 0.045 2.207 ##
2018 Feb 20
3
Take the maximum of every 12 columns
This is what I was looking for. Thank you everyone! Sincerely, Milu <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Mail priva di virus. www.avast.com <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
2006 Jul 27
6
Any interest in "merge" and "by" implementations specifically for sorted data?
Hi Developers, I am looking for another new project to help me get more up to speed on R and to learn something outside of R internals. One recent R issue I have run into is finding a fast implementations of the equivalent to the following SAS code: /* MDPC is an integer sort key made from two integer columns */ MDPC = (MD * 100000) + PCO; /* sort the dataset by the key */ PROC SORT;
2013 Feb 01
29
cumulative sum by group and under some criteria
Thank you very much for your reply. Your code work well with this example. I modified a little to fit my real data, I got an error massage. Error in split.default(x = seq_len(nrow(x)), f = f, drop = drop, ...) : Group length is 0 but data length > 0 On Thu, Jan 31, 2013 at 12:21 PM, arun kirshna [via R] < ml-node+s789695n4657196h87@n4.nabble.com> wrote: > Hi, > Try this: >