Tony Plate writes:>foo
> [,1] [,2] [,3] [,4] [,5]
>[1,] NA 1 NA NA NA
>[2,] NA 1 NA NA 1
>[3,] NA 1 1 NA 1
>[4,] NA NA 1 1 1
>[5,] 1 NA NA 1 NA
>
>I want to get a vector that is the column numbers as sorted by the first
>non-NA value.
>Like this:
>2,5,3,4,1
order(apply(foo,2,which.min))