Displaying 20 results from an estimated 10000 matches similar to: "Please help with min()"
2003 Jan 31
2
minor error in documentation of pmax in base (PR#2513)
The documentation says, "pmax and pmin take several vectors as
arguments and return a single vector giving the parallel maxima
(or minima) of the vectors."
I discovered that, if you use a matrix or array instead of a
vector, pmax returns a matrix or array, respectively.
This makes pmax and pmin much more useful, and should not be left
to people to discover on their own!
For example:
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
2010 Jan 29
3
Vector from Matrix
Dear Mailing List Members,
the problem I've been grappling with für quite some time now is the following:
I have a 100 rows x 200 columns matrix.
data.set <- matrix(rnorm(20000, 100, 200))
Now I would like to get a vector of length 100 which collects the values from the following procedure:
Take the sum of the minima of the two values from each row of columns 1 and 101, and divide it
2006 Mar 15
3
which.minimums not which.min
Hi
Is there a function which determines the location, i.e., index of the all minimums or maximums of a numeric vector.
Which.min(x) only finds the (first) of such.
> x <- c(1:4,0:5, 4, 11)
> x
[1] 1 2 3 4 0 1 2 3 4 5 4 11
> which.min(x)
[1] 5
> which.max(x)
[1] 11
>
but I need
which.min(x) to be 5 11
which.max(x) to be 4 10
2008 Dec 09
1
package "wmtsa": wavCWTPeaks error (PR#13381)
Full_Name: Maura Monville
Version: 2.8
OS: Mac OS/X 10.5
Submission from: (NULL) (87.4.122.234)
Here is the code that causes wavCWTPeaks error
aats <- create.signalSeries(aa, pos=list(from=0.0, by=0.033))
aa.cwt <- wavCWT(aats)
x11 (width=10,height=12)
plot (aats,main=paste(insig," Cycle: ",j,sep=""))
aa.maxtree <- wavCWTTree (aa.cwt,
2009 Nov 03
2
1 dimensional optimization with local minima
I am using numerical optimization to fit a 1 parameter model, in which the
input parameter is bounded. I am currently using optimize(), however, the
problem turns out to have local minima, and optimize does not always seem to
find the global minimum. I could to write a wrapping function that tries
multiple intervals or starting values, but I would prefer a package that has
built-in methods to make
2005 Jun 15
1
Finding local minima and maxima
I have data in the form of (x,y) pairs and would like to find local
minima and maxima (typically the zeros of the 2nd derivative) of the y
values. I looked at numericDeriv, but I don't have an "expression" per
se. I looked at optim, also, but it looks like it will find only one
"global" max or min. I can code up my own piecewise derivatives, but
wondered if there is
2012 Jul 03
2
NADA Data Frame Format: Wide or Long?
I have water chemistry data with censored values (i.e., those less than
reporting levels) in a data frame with a narrow (i.e., database table)
format. The structure is:
$ site : Factor w/ 64 levels "D-1","D-2","D-3",..: 1 1 1 1 1 1 1 1 ...
$ sampdate: Date, format: "2007-12-12" "2007-12-12" ...
$ preeq0 : logi TRUE TRUE TRUE TRUE TRUE
2011 Jul 27
2
fitting sine wave
Dear R-helpers
?
I have 7 data points that I want to fit a continuous curve to, that should look similar to a sine wave
My data points would mark the local minima and maxima respectively.
This is what I?ve got so far. And I would keep doing so, but sadly nls() then says that it has reached the maximum number of Iterations?
?
2009 Sep 17
1
Turning points in a series
Good morning once more. My problem of yesterday has been addressed. Having
learned a few tricks from that, I wish to ask another question in connection
with that. My data is a cosmic ray data consisting of dates and counts. When
I plot a graph of counts versus dates, the resultant signal shows a number
of maximum and minimum points. These minimum points (turning points) are of
interest to me.
2017 Aug 26
0
Find maxima of a function
> On 26 Aug 2017, at 16:39, niharika singhal <niharikasinghal1990 at gmail.com> wrote:
>
> Hi,
>
> Thanks for your mail, and time
>
> It is not working for some arguments, when mean value is like >6.
>
>
> case
>
> mc0 <- c(0.08844446,0.1744455,0.1379778,0.1209769,0.1573065,0.
> 1134463,0.2074027)
>
> rv
2008 Feb 21
1
Finding local maxima (height) in a matrix data (6 spatial coordinates)?
Dear all,
I wonder which R algorithm could perform a search of local maxima in
an spatial grid, in other words, having the coordinates of a map
(x,y,z... up to 6 coordinates) and then the altitude/height at each
point (h) (in total 7 numerical variables) I would like to localise
the peaks (local maxima) of that topological surface. Which R
algorithm can perform this?
Thanks a lot,
Josep Maria,
2017 Aug 26
1
Fwd: Find maxima of a function
Hi,
Thanks for your mail, and time
It is not working for some arguments, when mean value is like >6.
case
mc0 <- c(0.08844446,0.1744455,0.1379778,0.1209769,0.1573065,0.
1134463,0.2074027)
rv <-UnivarMixingDistribution(Norm(486.4255, 53.24133),
Norm(664.0713, 3.674773),
Norm(669.0484, 4.101381),
2008 Apr 27
1
parallel max, min, and median of dataframe columns
Hello, all,
I have a dataframe of three rows and umpteen columns. I want to show the
maximum, minimum, and median with a vertical line and a central dot (I'd
use a boxplot, but with only three data points, that's overkill; I can't
just use points, because of overlap and some of the other data plotted on
the graph).
This works:
> boxplot(data_frame,
2004 Mar 19
5
loop through files in a dir
Hello
I have data in many files in a directory, how can I
loop through the files in a given dir in-order-to
build a data.frame?
thanks
2010 Mar 18
4
Please help with loop, thanks
Dear R helpers,
I would like to write a loop that makes 4 objects (called A, B, C, and D)
each of which contains ten random numbers.
This attempt:
individuals<-c("A","B","C","D")
for(i in 1:length(individuals)) {
individuals[i]<-rnorm(10)
}
does not work because "individuals[i]" is not the proper way to extract each
letter from the
2009 Jan 29
2
Taking the min of each row in a matrix
Hi,
I'm a new user. I've been reading through the manual and looking at
various examples but am still trying to make sense of the most
efficient ways to handle matrices of data.
If I have a 2D matrix of data, how do I get the mean, min, max value
of each row? I see the "mean" function on a matrix will give me
averages by row, but min and max give me the value for the entire
2008 Nov 06
2
comparing matrices using max or min
Dear all,
I have 3 matrices with the same dimension, A,B,C and I would like to produce
a matrix D where in each position would retrieve the max(or min) value along
A,B,C taken from the same position.
I guess that apply functions should fit, but for matrices objects I am not
getting it.
thanks in advance,
Diogo André Alagador
[[alternative HTML version deleted]]
2008 Dec 09
2
Applying min to numeric vectors
I was surprised this morning, that it seems as though the min() function
does not work as *I* anticipated when given vector arguments.
For example:
a <- 1:10
b <- c(rep(1, times=5), rep(10, times=5))
Result:
> min(a,b)
1
What I actually wanted was a term by term minimum, i.e.:
ifelse(a<=b, a, b)
1 1 1 1 1 6 7 8 9 10
Am I losing much in terms of computation power if I use
2009 Jul 24
2
How to find the min and max of two variables in a data frame
I have two variables in a data frame, I want to generate two additional
variables. For every observations (i.e. every row), I want the first new
variable 'min' to carry the minimum of the two existing variables, and I
want the second new variable 'max' to carry the maximum of the two existing
variables. I then want to sort the data frame by min and max, and delete
duplicated rows