gpt4 book ai didi

R 语言 NaN + NA 行为

转载 作者:行者123 更新时间:2023-12-02 06:05:56 24 4
gpt4 key购买 nike

我有一个关于 R 中算术行为的问题。看下面这段代码

> NaN + NA
[1] NaN
>
>
> NaN + as.integer(NA)
> NA

所以,我很困惑这两个添加给出了不同的结果。有谁知道这是否是真正想要的行为还是只是某种错误?

提前致谢

最佳答案

来自 ?NaN:

Computations involving NaN will return NaN or perhaps NA: which of those two is not guaranteed and may depend on the R platform (since compilers may re-order computations).

关于R 语言 NaN + NA 行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11328938/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com