[R] help

Simon Wood simon at stats.gla.ac.uk
Mon Mar 15 11:18:58 CET 2004


> I want to extract the first non-zero digit of any vector, as for example
> from a<-runif(100,0,1).

a[min((1:length(a))[a!=0])]

_____________________________________________________________________
> Simon Wood simon at stats.gla.ac.uk        www.stats.gla.ac.uk/~simon/
>>  Department of Statistics, University of Glasgow, Glasgow, G12 8QQ
>>>   Direct telephone: (0)141 330 4530          Fax: (0)141 330 4814




More information about the R-help mailing list