search for: rowmax

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

Did you mean: rowman
2010 Mar 29
1
Suggestion: Adding quick rowMin and rowMax functions to base package
...Runtime ca. 12 seconds # My unelegant rowMin function z=rowMin(x) # Runtime ca 0.5 seconds Of course, the way the function rowMin is constructed is highly ineffective if the matrix x has many columns, but maybe there is a simple way to adapt the code from pmin and pmax to create quick rowMin, rowMax,... functions. I don't know whether it is worth the effort, but I guess taking minima and maxima over rows is a common task. Best wishes, Sebastian
2007 Mar 03
0
2 bugs in max.col() (PR#9542)
...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, since max.col() is widely used and since I only occasionally program C, I'd appreciate if someone would do code-review and (again) thorough testing before publishing it. Please note that the code was developed under R 1.6.2 and might ne...
2009 Sep 19
1
matrix operations on grobs and grid units
...impler stringWidth() and stringHeight(). (Correct?). The input of this function is a vector of labels, which are arranged into a matrix layout. Below is my current version, followed by a few questions. e = expression(alpha,"testing very large width", hat(beta), integral(f(x)*dx, a, b)) rowMax.units <- function(u, nrow){ # rowMax with a fake matrix of units matrix.indices <- matrix(seq_along(u), nrow=nrow) do.call(unit.c, lapply(seq(1, nrow), function(ii) { max(u[matrix.indices[ii, ]]) })) } colMax.units <- function(u, ncol){ # colMax with a fake matrix of units matrix.in...
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. Assistant Professor The Center on Aging and Health Division of Geriat...
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...
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 i...
2011 Mar 02
2
*** caught segfault *** when using impute.knn (impute package)
...39;memory not mapped' Traceback: 1: .Fortran("knnimp", x, ximp = x, p, n, imiss = imiss, irmiss, as.integer(k), double(p), double(n), integer(p), integer(n), PACKAGE = "impute") 2: knnimp.internal(x, k, imiss, irmiss, p, n, maxp = maxp) 3: knnimp(x, k, maxmiss = rowmax, maxp = maxp) 4: impute.knn(dummy0, k) Possible actions: 1: abort (with core dump, if enabled) 2: normal R exit 3: exit R without saving workspace 4: exit R saving workspace ################## thanks for your help in advance! tina -- Bettina Kulle Andreassen University of Oslo Department...
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: >