[R] Inconsistency of 1^NA=1 vs. 1.1^NA=NA
Spencer Graves
spencer.graves at effectivedefense.org
Thu Nov 17 22:00:06 CET 2016
> (1+ 0i)^ NA
[1] NA
> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.6 (El Capitan)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils
[5] datasets methods base
other attached packages:
[1] lubridate_1.6.0
loaded via a namespace (and not attached):
[1] magrittr_1.5 rsconnect_0.5 tools_3.3.1
[4] stringi_1.1.2 stringr_1.1.0
>
On 11/17/2016 2:47 PM, Da Zheng wrote:
> I tried on my computer.
>> (1+ 0i)^ NA
> [1] NaN+NaNi
>
>
> On Thu, Nov 17, 2016 at 3:42 PM, Bert Gunter <bgunter.4567 at gmail.com> wrote:
>
>> On Nov 17, 2016 11:55 AM, "Thierry Onkelinx" <thierry.onkelinx at inbo.be>
>> wrote:
>>> Dear Da,
>>>
>>> NA represents an unknown value x. 1 ^ x = 1 for all possible values of x.
>>> Hence 1 ^ NA = 1.
>>>
>> That is false. For any n, n-1 of the nth roots of 1 differ from 1(they are
>> complex). I don't have my computer with me. What does (1+ 0i)^ NA give?
>>
>> Bert
>>
>>> Best regards,
>>>
>>> ir. Thierry Onkelinx
>>> Instituut voor natuur- en bosonderzoek / Research Institute for Nature
>> and
>>> Forest
>>> team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
>>> Kliniekstraat 25
>>> 1070 Anderlecht
>>> Belgium
>>>
>>> To call in the statistician after the experiment is done may be no more
>>> than asking him to perform a post-mortem examination: he may be able to
>> say
>>> what the experiment died of. ~ Sir Ronald Aylmer Fisher
>>> The plural of anecdote is not data. ~ Roger Brinner
>>> The combination of some data and an aching desire for an answer does not
>>> ensure that a reasonable answer can be extracted from a given body of
>> data.
>>> ~ John Tukey
>>>
>>> 2016-11-17 20:19 GMT+01:00 Da Zheng <zhengda1936 at gmail.com>:
>>>
>>>> Hello,
>>>>
>>>> I just realized that 1^NA outputs 1 while 1.1^NA outputs NA in R
>> v3.3.1 and
>>>> R v3.2.3.
>>>> I tried other values such as 0^NA and 2^NA, and they all output NA.
>>>> I don't understand this inconsistency here. Shouldn't 1^NA output NA as
>>>> well? Why does R handle it differently? Or is this a bug in these
>>>> particular versions of R?
>>>>
>>>> Thanks,
>>>> Da
>>>>
>>>> [[alternative HTML version deleted]]
>>>>
>>>> ______________________________________________
>>>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>>> 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.
>>>>
>>> [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> 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.
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
More information about the R-help
mailing list