Friday, March 11, 2011

How to find minimizer in R

Suppose x is a vector, the following command finds its minimum:
min(x)

To find the minimizer, we can use the following command:
which(x==min(x))
It gives the index for the minimum.

No comments:

Visitors