I did the following experiment, since there's no mention of complex data on the approx
help page:
Rgames> zfoo
[1] 1+ 6i 2+ 7i 3+ 8i 4+ 9i 5+10i
Rgames> approx(zfoo,n=10)
$x
[1] 1.000000 1.444444 1.888889 2.333333 2.777778 3.222222 3.666667 4.111111
[9] 4.555556 5.000000
$y
[1] 6.000000 6.444444 6.888889 7.333333 7.777778 8.222222 8.666667
[8] 9.111111 9.555556 10.000000
Digging into the code for approx
, I discovered that xy.coords
(also apparently undocumented for complex data) treats the Real and Imag parts of complex data as the x
and y
parts of coordinate data. So my question is: is this intended behavior? I'm always a bit paranoid about depending on functionality that isn't explicitly documented.