Is this what you want? > x [1] NA NA 10 NA 2 NA NA 1 NA NA > y [1] 10 20 30 40 50 60 70 80 85 100 > y[max(which(!is.na(x)))] [1] 80
Andy From: Anders Bjørgesæter > > Hello > > Is there a function to extract the position (i.e. row number or more > desirable the value from another column with the same rownumber ) of > last number in a vector? This is done in a loop with 1000s of columns. > > e.g. > > vector/column.n: na,na,10,na,2,na,na,1,na,na > fixed column:10,20,30,40,50,60,70,80,85,100 > > result: 8 and/or 80 > > Thanks... > > Best Regards > Anders > > ______________________________________________ > 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 > > ______________________________________________ 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