Displaying 3 results from an estimated 3 matches for "r70604".
Did you mean:
270604
2016 Jun 03
0
complex NA's match(), etc: not back-compatible change proposal
With 'z' of length 8 below, or of length 12 previously, one may try
sapply(rev(z), match, table = rev(z))
match(rev(z), rev(z))
I found that the two results were different in R devel r70604.
A shorter one:
> z <- complex(real = c(0,NaN,NaN), imaginary = c(NA,NA,0))
> sapply(z, match, table = z)
[1] 1 1 2
> match(z, z)
[1] 1 1 3
An explanation of the behavior: With normal equality, if z[2] is equal to z[1] and z[3] is not equal to z[1], z[3] is not equal to z[2]. It is n...
2016 May 28
1
complex NA's match(), etc: not back-compatible change proposal
...t; factor(c(complex(real=NaN), complex(imaginary=NaN)))
[1] NaN+0i <NA>
Levels: NaN+0i
Look at <NA> in the result above. Yes, it happens in earlier versions of R, too.
On matching both NA and NaN, another consequence is that length(unique(.)) may depend on order. Example using R devel r70604:
> x0 <- c(0,1, NA, NaN); z <- outer(x0,x0, complex, length.out=1); rm(x0)
> (z <- z[is.na(z)])
[1] NA NaN+ 0i NA NaN+ 1i NA NA NA NA
[9] 0+NaNi 1+NaNi NA NaN+NaNi
> length(print(unique(z)))
[1] NA NaN+0i
[1] 2
> length(pri...
2016 May 13
1
complex NA's match(), etc: not back-compatible change proposal
...(z)])
[1] NA NaN+ 0i NA NaN+ 1i NA NA NA NA
[9] 0+NaNi 1+NaNi NA NaN+NaNi
> sapply(z, match, table = z[8])
[1] 1 1 1 1 1 1 1 1 1 1 1 1
> match(z, z[8])
[1] 1 1 1 1 1 1 1 1 1 1 1 1
> sessionInfo()
R Under development (unstable) (2016-05-12 r70604)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows XP (build 2600) Service Pack 2
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached bas...