Displaying 1 result from an estimated 1 matches for "bahave14".
2012 Mar 12
2
Maximum of remaining elements of vector
...ex.
x<-c(1,2,3,4,1,2,3,1,2,1)
f(x) = c(4,4,4,4,3,3,3,2,2,1)
where the first element is: max(x[1:length(x])
the second one: max(x[2:length(x)])
the third one: max(x[3:length(x)]) and so on
Of course this can be done with a loop, but isn't there a nicer and faster
way to do so?
Regards,
bahave14
--
View this message in context: http://r.789695.n4.nabble.com/Maximum-of-remaining-elements-of-vector-tp4466499p4466499.html
Sent from the R help mailing list archive at Nabble.com.