[R] Help on apply() function

Mark Lyman mark.lyman at gmail.com
Wed Aug 30 06:42:08 CEST 2006


Anusha <anu1978 <at> hotmail.com> writes:

> 
> Respected Sir/Madam,
> 
> I have a problem with apply function. I have to two matrices of dimension of
> one column but n rows. I have to check whether one matrix is greater than
> other by going thru each row (ie) using if condition to check one matrix
> with another matrix. 
> 
> I like to use apply() function to this approach. That is apply function
> between two matrices. I searched for examples online but I couldn't find
> any.
> 
> I don't know how to loop thru the matrices.
> 
> Please help with this problem.
> 
> Any help is appreciated.
> 
> My mailid is monkponu <at> yahoo.com.
> 
> Thanks,
> Anusha.
>

You can use the functions all.equal with the function isTRUE (see ?all.equal) to
check if two objects are nearly equal (within a certain tolerance). Or you can
use identical (see ?identical) to check if they are exactly the same. See the
examples in the help for identical.

Mark Lyman



More information about the R-help mailing list