search for: min_vect

Displaying 2 results from an estimated 2 matches for "min_vect".

2012 Apr 05
2
how to compute a vector of min values ?
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.7896...
2012 Mar 25
2
avoiding for loops
I have data that looks like this: > df1 group id 1 red A 2 red B 3 red C 4 blue D 5 blue E 6 blue F I want a list of the groups containing vectors with the ids. I am avoiding subset(), as it is only recommended for interactive use. Here's what I have so far: df1 <- data.frame(group=c("red", "red", "red", "blue",