On Apr 8, 2010, at 4:03 PM, Jun Shen wrote:
David,
all.equal() only tells how many mismatches there are including
missing values but it doesn't tell me the location of each mismatch.
Yes, I noticed that after further testing. I agree Charles' solution
is more informative and I wonder if
David,
all.equal() only tells how many mismatches there are including missing
values but it doesn't tell me the location of each mismatch.
For example, if I have one NA mismatch and three numerical mismatches,
all.equal(a,b) gives
[1] "Component 2: 'is.NA' value mismatch: 1 in current 0 in targe
On Apr 8, 2010, at 1:34 PM, Jun Shen wrote:
David,
Thanks for the suggestion. Now I have worked out a general solution.
Assume "a" and "b" are two data frames with same dimensions
1. Call identical(a,b) to get an overall assessment. If you get a
FALSE
2. Call which(mapply(identical,unlist(
David,
Thanks for the suggestion. Now I have worked out a general solution.
Assume "a" and "b" are two data frames with same dimensions
1. Call identical(a,b) to get an overall assessment. If you get a FALSE
2. Call which(mapply(identical,unlist(a),unlist(b))==FALSE), you will get a
result like
On Apr 8, 2010, at 9:47 AM, Jun Shen wrote:
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
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 tha
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
[[alternat
On Apr 7, 2010, at 9:55 PM, Erik Iverson wrote:
Jun Shen wrote:
Hi, David,
Thanks for the reply. However str() doesn't tell me exactly which
element is
different. I expect to see a is identical to b. But if there is
some minor
difference (usually by human mistake), I want to know which el
Jun Shen wrote:
Hi, David,
Thanks for the reply. However str() doesn't tell me exactly which element is
different. I expect to see a is identical to b. But if there is some minor
difference (usually by human mistake), I want to know which element
(numerical or character) is different.
So you'
Hi, David,
Thanks for the reply. However str() doesn't tell me exactly which element is
different. I expect to see a is identical to b. But if there is some minor
difference (usually by human mistake), I want to know which element
(numerical or character) is different.
Jun
On Wed, Apr 7, 2010 at
On Apr 7, 2010, at 9:31 PM, 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.
You could try:
str(a); str(b)
David Winsemius, MD
Wes
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.
Jun
[[alternative HTML version deleted]]
__
R-help@r-pr
12 matches
Mail list logo