Dear David, Erik and Charles, Thank you for your input. Both mapply() and which() can do the job. Just one exception. If there is a missing value as NA in the data frame "a" and a data point (either numerical or character) in the corresponding position of "b", then mapply() only returns NA for that position rather than "FALSE", and which() cannot pick up that position either. Thanks again.
Jun On Wed, Apr 7, 2010 at 10:46 PM, Charles C. Berry <[email protected]>wrote: > On Wed, 7 Apr 2010, Jun Shen wrote: > > Dear all, >> >> I understand identical (a,b) will tell me if a and b are exactly the same >> or >> not. But what if they are different, is there anyway to tell which >> element(s) are different? Thanks. >> > > which( a != b, arr.ind = TRUE) > > HTH, > > Chuck > >> >> Jun >> >> >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> [email protected] 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. >> >> > Charles C. Berry (858) 534-2098 > Dept of Family/Preventive > Medicine > E mailto:[email protected] UC San Diego > http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901 > > > [[alternative HTML version deleted]] ______________________________________________ [email protected] 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.

