[R] vectorized compare

Sundar Dorai-Raj sundar.dorai-raj at pdf.com
Mon Jan 13 17:25:21 CET 2003


Zhongming,

Zhongming Yang wrote:
> R experts:
> 
> Is there any vectorized logical comparison in R?
> 
> For instance I want stop some iterartion process until the every
> component of the error vector all small than 1%.
> 

If eps is your vector of errors, use:

all(eps < 0.01)

or

all(abs(eps) < 0.01)

Regards,
Sundar




More information about the R-help mailing list