[R] How do I tell whether two vectors are identical?

David Winsemius dwinsemius at comcast.net
Tue Oct 12 19:58:53 CEST 2010


And ...

?which

which(abs(x-y) >0)   # or if these are subject to FAQ 7.31, then
which( zapsmall( abs(x-y)) > 0 )

.. for second part of question.

-- David.
On Oct 12, 2010, at 1:43 PM, Bert Gunter wrote:

> Try preusing an Intro to R for such elementary questions, please. Also
> the R Help facility.
>
> But...
>
> ?identical   ##(oddly enough...)
> ?"=="
>
> But beware numerical issues -- see R FAQ 7.31.
>
> -- Bert
>
>
> On Tue, Oct 12, 2010 at 10:35 AM, ANJAN PURKAYASTHA
> <anjan.purkayastha at gmail.com> wrote:
>> Hi,
>> I have two vectors, each of length 45000.
>> How do I compare the vectors to ascertain if they are identical.  
>> Secondly if
>> they are NOT identical, how do I determine the indices of positions  
>> at which
>> the vectors differ?
>> Thanks,
>> Anjan
>>
>>
>> --
>> ===================================
>> anjan purkayastha, phd.
>> research associate
>> fas center for systems biology,
>> harvard university
>> 52 oxford street
>> cambridge ma 02138
>> phone-703.740.6939
>> ===================================
>>
>>        [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
>
> -- 
> Bert Gunter
> Genentech Nonclinical Biostatistics
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list