> 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 [EMAIL PROTECTED]        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

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to