Sorry, I accidentaly lost one line of the function code (result <-0), 
see below...
Regards, Martin

Martin Becker schrieb:
>
> myfun1 <- function(series=c(3, 4, 10,14,8,3,4,6,9)) {
     result <- 0                        # NEW
>  len<-length(series)
>  for (i in (len-1):1)
>  {
>    if (series[i]>series[len])
>    { result <- i-1 ; break }
>  }
>  return(result)
> }
>
...

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to