[R] how to compute a vector of min values ?

ikuzar razuki at hotmail.fr
Fri Apr 6 00:25:45 CEST 2012


Hi, 

I'd like to know how to get a vector of min value from many vectors without
making a loop. For example :

>v1 = c( 1, 2, 3)
> v2 =  c( 2, 3, 4)
> v3 = c(3, 4, 5)
> df = data.frame(v1, v2, v3)
> df
  v1 v2 v3
1  1  2  3
2  2  3  4
3  3  4  5
> min_vect = min(df)
> min_vect
[1] 1

I 'd like to get min_vect = (1, 2, 3), where 1 is the min of v1, 2 is the
min of v2 and 3 is the min of v3.

The example above are very easy but, in real, I have got v1, v2, ... v1440 

Thanks for your help, 

ikuzar

--
View this message in context: http://r.789695.n4.nabble.com/how-to-compute-a-vector-of-min-values-tp4536224p4536224.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list